diff --git a/karma.conf.js b/karma.conf.js index 3f3fd12..d7ef18d 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -32,12 +32,12 @@ module.exports = function (config) { }, files: [ 'node_modules/jquery/dist/jquery.js', - 'src/test.ts' + 'src/test.js' // 'src/**/*.spec.ts' ], preprocessors: { // 'web/**/*.ts': ['webpack'], - 'src/test.ts': ['webpack'], + 'src/test.js': ['webpack'], // 'test/test.js': ['webpack'], // 'web/ui-framework/**/*.js': ['webpack'], // 'test/testing-utils/*.ts': ['karma-typescript'], diff --git a/src/app/hero.ts b/src/app/hero.ts index e3eac51..a61b497 100644 --- a/src/app/hero.ts +++ b/src/app/hero.ts @@ -1,4 +1,4 @@ -export class Hero { +export interface Hero { id: number; name: string; } diff --git a/src/main.ts b/src/main.js similarity index 100% rename from src/main.ts rename to src/main.js diff --git a/src/test.ts b/src/test.js similarity index 78% rename from src/test.ts rename to src/test.js index ba05600..6ea6a89 100644 --- a/src/test.ts +++ b/src/test.js @@ -2,11 +2,11 @@ // Then we find all the tests. import { TestBed } from 'angularjs-testbed'; -const context = (require as any).context('./', true, /\.spec\.ts$/); +const context = require.context('./', true, /\.spec\.ts$/); context.keys().map(context); // source files are needed only for coverage -const source = (require as any).context('./app/', true, /\.ts$/); +const source = require.context('./app/', true, /\.ts$/); source.keys().map(source); // set strictDi on angular.mock.inject to catch errors if /*@ngInject*/ is missing diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index 967b37b..05f1e0c 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -1,7 +1,11 @@ { "extends": "../tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true + }, "exclude": [ - "test.ts", - "**/*.spec.ts" + "test.(js|ts)", + "**/*.spec.(js|ts)" ] } diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json index 654e063..99fd39c 100644 --- a/src/tsconfig.spec.json +++ b/src/tsconfig.spec.json @@ -1,6 +1,10 @@ { "extends": "../tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + }, "files": [ - "test.ts" + "test.js" ] } diff --git a/tsconfig.json b/tsconfig.json index 2dd9f47..07103b8 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "target": "es5", "module": "es2015", "lib": [ - "es2017", + "es2018", "dom" ] }, diff --git a/webpack.config.js b/webpack.config.js index a2e29c3..606003e 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -39,7 +39,7 @@ module.exports = (env, argv) => { const config = { entry: { - app: sourcePath + '/main.ts', + app: sourcePath + '/main.js', }, output: { path: distPath, @@ -61,7 +61,7 @@ module.exports = (env, argv) => { use: [MiniCssExtractPlugin.loader, 'css-loader', 'resolve-url-loader', 'sass-loader'] }, { - test: /\.ts$/, + test: /\.(js|ts)$/, exclude: /node_modules/, use: [ { diff --git a/webpack.test.js b/webpack.test.js index 734c069..82a5806 100755 --- a/webpack.test.js +++ b/webpack.test.js @@ -28,7 +28,7 @@ module.exports = { use: ['css-loader', 'resolve-url-loader', 'sass-loader'] }, { - test: /\.ts$/, + test: /\.(js|ts)$/, exclude: /node_modules/, use: [ {