小编nee*_*ame的帖子

Jasmine测试不在编译的Typescript中的define中启动的情况

我正在使用一个测试项目,我正在编写一个纯Javascript Jasmine Karma设置来测试预编译的Typescript设置.但是,我无法启动测试用例.

我可以在控制台中看到来自编译的打字稿的控制台消息,但它根本不会启动测试脚本.

请注意,这来自AngularApp,但这整个部分来自一个没有Angular2的部分.

没有错误消息,除此之外显示0/0测试已运行,并且"component/to/test"没有时间戳.

在test.spec.js文件中,我有

define("testName", ["component/to/test"], function(component){
    describe("testing module", function(){
         it("should work", function(){expect(true).toEqual(true)});
    })
}
Run Code Online (Sandbox Code Playgroud)

在已编译的打字稿文件中,myTs.js

var requirejs, require, define;
(function (global) {

    define("component/to/test" ["depend", "ences"]), function(depend,ences)
    { more code here }) 

     some compiled typescript here
});
require.config({
     path: {path to javascript libs},
     shim: { ... }
})
Run Code Online (Sandbox Code Playgroud)

在我的业力档案中

basePath: '',
frameworks: ['jasmine', 'requirejs'],
files: [
     'lib1',
     'lib2',
     'spec/test-main.js',
     {pattern: 'js/*.js', included: true, served: true},
     {pattern: 'spec/*.spec.js', included: false, served: true}
],
exclude: [],
reporters: ['progress'],
autoWatch: …
Run Code Online (Sandbox Code Playgroud)

javascript jasmine typescript karma-jasmine

7
推荐指数
1
解决办法
343
查看次数

在c#中获取关于不引用System.XML的编译错误,是System.XML正在引用

我正在尝试为我编写的旧程序添加新功能.但是,当试图让程序在VS express中构建时,它会向我发回错误消息.

错误1类型'System.Xml.Serialization.IXmlSerializable'在未引用的程序集中定义.您必须添加对程序集'System.Xml,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的引用.C:\ Path\To\File\summaryForm.cs 101 18 SerialController

然而事情是在cs文件的顶部,它有

using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms; 
using System.Xml;
Run Code Online (Sandbox Code Playgroud)

任何想法为什么不识别XML引用?

c# xml compiler-errors visual-studio-2012

5
推荐指数
2
解决办法
1万
查看次数

如何获得Spring Boot来解析thymeleaf-extras-springsecurity标签?

我是第一次使用Spring Boot创建一个网站。我正在使用一个测试页来显示用户登录后,用户登录后屏幕上会出现“已认证”字样。

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<h2>Thymleaf example</h2>
<p sec:authorize="hasRole('ROLE_USER')">
    Authenticated
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

但是,问题在于带有sec:authorize的标记仍未编辑和未解析。结果,无论用户是否登录,都会显示Authenticated单词。从控制器打印用户权限可以确认这一点。

我的pom.xml文件具有以下依赖性。

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-springsecurity4</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    ... dependencies for mysql and jdbc are omitted.
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏。注意,我使用的是Spring Boot,因此JAVA配置优于XML配置。

spring spring-mvc thymeleaf spring-boot

5
推荐指数
1
解决办法
7140
查看次数

Python:将字节转换为二进制并移动其位?

我想为学校项目将 Python 中的一种编码转换为另一种编码。但是,我正在翻译的编码将在第一位的编码中添加填充。

如何将二进制数字序列向左移动一位,以便它来自:

00000001 11001100 01010101 等等

00000011 10011000 10101010 等等

那么最终结果的最低位将是前者的最高位数?

python binary

4
推荐指数
1
解决办法
1万
查看次数