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",
|
"main": "index.js",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "echo todo"
|
"build": "echo todo",
|
||||||
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/jest": "^26.0.15",
|
||||||
|
"jest": "^26.6.3",
|
||||||
|
"ts-jest": "^26.4.4",
|
||||||
|
"typescript": "^4.0.5",
|
||||||
"webpack": "^5.4.0"
|
"webpack": "^5.4.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"webpack-chain": "^6.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
import base from './base';
|
import base from './base';
|
||||||
|
import Config from 'webpack-chain';
|
||||||
|
|
||||||
// todo: add base configuration for vue
|
// todo: add base configuration for vue
|
||||||
export default function (env) {
|
export default function (env) {
|
||||||
const config = base(env);
|
const config = new Config().merge(base(env));
|
||||||
|
|
||||||
// todo: we may want to use webpack-chain internally
|
// todo: we may want to use webpack-chain internally
|
||||||
// to avoid "trying to read property x of undefined" type of issues
|
// to avoid "trying to read property x of undefined" type of issues
|
||||||
config.module.rules.push({
|
/*
|
||||||
test: /.vue$/,
|
config.module.rules.push({
|
||||||
use: [],
|
test: /.vue$/,
|
||||||
});
|
use: [],
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"lib": [ "es2017" ],
|
"lib": [
|
||||||
"sourceMap": true,
|
"es2017"
|
||||||
"skipLibCheck": true,
|
],
|
||||||
"skipDefaultLibCheck": true,
|
"sourceMap": true,
|
||||||
"diagnostics": true
|
"skipLibCheck": true,
|
||||||
},
|
"skipDefaultLibCheck": true,
|
||||||
"exclude": [
|
"diagnostics": true,
|
||||||
"node_modules",
|
"paths": {
|
||||||
]
|
"@nativescript/webpack": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"allowSyntheticDefaultImports": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user