Skip to content

Allow using plain JavaScript with TypeScript ones. Closes #28 #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion src/app/hero.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}
File renamed without changes.
4 changes: 2 additions & 2 deletions src/test.ts → src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true
},
"exclude": [
"test.ts",
"**/*.spec.ts"
"test.(js|ts)",
"**/*.spec.(js|ts)"
]
}
6 changes: 5 additions & 1 deletion src/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
},
"files": [
"test.ts"
"test.js"
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"target": "es5",
"module": "es2015",
"lib": [
"es2017",
"es2018",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = (env, argv) => {

const config = {
entry: {
app: sourcePath + '/main.ts',
app: sourcePath + '/main.js',
},
output: {
path: distPath,
Expand All @@ -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: [
{
Expand Down
2 changes: 1 addition & 1 deletion webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
use: ['css-loader', 'resolve-url-loader', 'sass-loader']
},
{
test: /\.ts$/,
test: /\.(js|ts)$/,
exclude: /node_modules/,
use: [
{
Expand Down