File tree Expand file tree Collapse file tree 9 files changed +124
-0
lines changed
test/execution-tests/3.0.1_resolveJsonModule Expand file tree Collapse file tree 9 files changed +124
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-var, strict */
2
+ 'use strict' ;
3
+ var path = require ( 'path' ) ;
4
+ var webpack = require ( 'webpack' ) ;
5
+ var webpackConfig = require ( './webpack.config.js' ) ;
6
+ var reporterOptions = require ( '../../reporterOptions' ) ;
7
+
8
+ module . exports = function ( config ) {
9
+ config . set ( {
10
+ browsers : [ 'ChromeHeadless' ] ,
11
+
12
+ files : [
13
+ // This loads all the tests
14
+ 'main.js'
15
+ ] ,
16
+
17
+ port : 9876 ,
18
+
19
+ frameworks : [ 'jasmine' ] ,
20
+
21
+ logLevel : config . LOG_INFO , //config.LOG_DEBUG
22
+
23
+ preprocessors : {
24
+ 'main.js' : [ 'webpack' , 'sourcemap' ]
25
+ } ,
26
+
27
+ webpack : {
28
+ devtool : 'inline-source-map' ,
29
+ mode : webpackConfig . mode ,
30
+ module : webpackConfig . module ,
31
+ resolve : webpackConfig . resolve ,
32
+
33
+ // for test harness purposes only, you would not need this in a normal project
34
+ resolveLoader : webpackConfig . resolveLoader
35
+ } ,
36
+
37
+ webpackMiddleware : {
38
+ quiet : true ,
39
+ stats : {
40
+ colors : true
41
+ }
42
+ } ,
43
+
44
+ // reporter options
45
+ mochaReporter : reporterOptions
46
+ } ) ;
47
+ } ;
Original file line number Diff line number Diff line change
1
+ const testsContext = require . context ( './' , true , / \. t e s t s \. t s ( x ? ) $ / ) ;
2
+ testsContext . keys ( ) . forEach ( testsContext ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " basic" ,
3
+ "license" : " MIT" ,
4
+ "version" : " 1.0.0" ,
5
+ "main" : " index.js" ,
6
+ "devDependencies" : {
7
+ "@types/jasmine" : " ^2.5.35" ,
8
+ "jasmine-core" : " ^2.3.4"
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ import * as someJson from './some.json' ;
2
+
3
+ export function getString ( ) {
4
+ return someJson . looks ;
5
+ }
6
+ export function getNumber ( ) {
7
+ return someJson . json ;
8
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "looks" : " like" ,
3
+ "json" : 5
4
+ }
Original file line number Diff line number Diff line change
1
+ import * as app from '../src/app' ;
2
+
3
+ // We don't actually care about the result of the following operations;
4
+ // what we care about is typescript resolving json as modules
5
+ // allowing this code to compile without errors, hence this:
6
+ // "noEmitOnError": true
7
+ // in tsconfig.json
8
+ describe ( "app" , ( ) => {
9
+ it ( "getString returns the expected value" , ( ) => {
10
+ expect ( app . getString ( ) ) . toBe ( "like" ) ;
11
+ } ) ;
12
+
13
+ it ( "getNumber returns the expected value" , ( ) => {
14
+ expect ( app . getNumber ( ) ) . toBe ( 5 ) ;
15
+ } ) ;
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "noEmitOnError" : true ,
4
+ "resolveJsonModule" : true
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' )
2
+
3
+ module . exports = {
4
+ mode : 'development' ,
5
+ entry : './app.ts' ,
6
+ output : {
7
+ filename : 'bundle.js'
8
+ } ,
9
+ resolve : {
10
+ extensions : [ '.ts' , '.js' ]
11
+ } ,
12
+ module : {
13
+ rules : [
14
+ { test : / \. t s $ / , loader : 'ts-loader' }
15
+ ]
16
+ }
17
+ }
18
+
19
+ // for test harness purposes only, you would not need this in a normal project
20
+ module . exports . resolveLoader = { alias : { 'ts-loader' : path . join ( __dirname , "../../../index.js" ) } }
Original file line number Diff line number Diff line change
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ " @types/jasmine@^2.5.35 " :
6
+ version "2.8.5"
7
+ resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.5.tgz#96e58872583fa80c7ea0dd29024b180d5e133678"
8
+
9
+ jasmine-core@^2.3.4 :
10
+ version "2.9.1"
11
+ resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.9.1.tgz#b6bbc1d8e65250d56f5888461705ebeeeb88f22f"
You can’t perform that action at this time.
0 commit comments