mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
test: add jest and simple spec
This commit is contained in:
13
packages/webpack5/__tests__/index.spec.ts
Normal file
13
packages/webpack5/__tests__/index.spec.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import * as webpack from '@nativescript/webpack';
|
||||
|
||||
describe('@nativescript/webpack', () => {
|
||||
it('exports base configs', () => {
|
||||
expect(webpack.angularConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.baseConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.javascriptConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.reactConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.svelteConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.typescriptConfig).toBeInstanceOf(Function);
|
||||
expect(webpack.vueConfig).toBeInstanceOf(Function);
|
||||
});
|
||||
});
|
7
packages/webpack5/jest.config.js
Normal file
7
packages/webpack5/jest.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
moduleNameMapper: {
|
||||
'^@nativescript/webpack$': '<rootDir>/src'
|
||||
}
|
||||
};
|
@ -5,9 +5,17 @@
|
||||
"main": "index.js",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "echo todo"
|
||||
"build": "echo todo",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.15",
|
||||
"jest": "^26.6.3",
|
||||
"ts-jest": "^26.4.4",
|
||||
"typescript": "^4.0.5",
|
||||
"webpack": "^5.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"webpack-chain": "^6.5.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
import base from './base';
|
||||
import Config from 'webpack-chain';
|
||||
|
||||
// todo: add base configuration for vue
|
||||
export default function (env) {
|
||||
const config = base(env);
|
||||
const config = new Config().merge(base(env));
|
||||
|
||||
// todo: we may want to use webpack-chain internally
|
||||
// to avoid "trying to read property x of undefined" type of issues
|
||||
/*
|
||||
config.module.rules.push({
|
||||
test: /.vue$/,
|
||||
use: [],
|
||||
});
|
||||
*/
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -7,13 +7,21 @@
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": [ "es2017" ],
|
||||
"lib": [
|
||||
"es2017"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"diagnostics": true
|
||||
"diagnostics": true,
|
||||
"paths": {
|
||||
"@nativescript/webpack": [
|
||||
"src"
|
||||
]
|
||||
},
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user