Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pikax committed Apr 30, 2022
1 parent 8e047df commit ee5243f
Show file tree
Hide file tree
Showing 9 changed files with 816 additions and 66 deletions.
23 changes: 0 additions & 23 deletions .flowconfig

This file was deleted.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "node scripts/build.js",
"build:ssr": "npm run build -- web-runtime-cjs,web-server-renderer",
"build:weex": "npm run build -- weex",
"test": "npm run lint && flow check && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr && npm run test:weex",
"test": "npm run lint && npm run ts-check && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr && npm run test:weex",
"test:unit": "karma start test/unit/karma.unit.config.js",
"test:cover": "karma start test/unit/karma.cover.config.js",
"test:e2e": "npm run build -- web-full-prod,web-server-basic-renderer && node test/e2e/runner.js",
Expand All @@ -35,7 +35,6 @@
"test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2",
"test:types": "tsc -p ./types/test/tsconfig.json",
"lint": "eslint src scripts test",
"flow": "flow check",
"ts-check": "tsc --noEmit",
"sauce": "karma start test/unit/karma.sauce.config.js",
"bench:ssr": "npm run build:ssr && node benchmarks/ssr/renderToString.js && node benchmarks/ssr/renderToStream.js",
Expand Down Expand Up @@ -80,6 +79,7 @@
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@rollup/plugin-replace": "^4.0.0",
"@types/he": "^1.1.2",
"@types/node": "^17.0.30",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.21.0",
Expand Down Expand Up @@ -107,7 +107,6 @@
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-jasmine": "^4.1.3",
"file-loader": "^6.2.0",
"flow-bin": "^0.176.3",
"hash-sum": "^2.0.0",
"he": "^1.1.1",
"http-server": "^14.1.0",
Expand All @@ -124,6 +123,7 @@
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^4.3.6",
"karma-sourcemap-loader": "^0.3.8",
"karma-typescript": "^5.5.3",
"karma-webpack": "^5.0.0",
"lint-staged": "^12.4.1",
"lodash": "^4.17.21",
Expand All @@ -140,6 +140,7 @@
"selenium-server": "^3.141.59",
"serialize-javascript": "^6.0.0",
"shelljs": "^0.8.5",
"stream-browserify": "^3.0.0",
"terser": "^5.13.1",
"ts-loader": "^9.2.9",
"ts-node": "^10.7.0",
Expand All @@ -154,8 +155,5 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@types/he": "^1.1.2"
}
}
2 changes: 1 addition & 1 deletion test/ssr/ssr-bundle-render.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function createRenderer (file, options, cb) {

compileWithWebpack(file, {
target: 'node',
devtool: asBundle ? '#source-map' : false,
devtool: asBundle ? 'source-map' : false,
output: {
path: '/',
filename: 'bundle.js',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/features/component/component-keep-alive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ describe('Component keep-alive', () => {
expect(vm.$el.innerHTML).toBe(
'<div class="test">one</div>'
)
}).then(done).then(done)
}).then(done)
})

// #4339
Expand Down
7 changes: 4 additions & 3 deletions test/unit/features/directives/class.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ function assertClass (assertions, done) {
}
}).then(() => {
expect(vm.$el.className).toBe(expected)
if (i >= assertions.length - 1) {
done()
}
// NOTE THIS WAS MAKING
// if (i >= assertions.length - 1) {
// done()
// }
})
})
chain.then(done)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/features/transition/transition-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ if (!isIE9) {
expect(vm.$el.innerHTML).toBe(
'<div class="test">one</div>'
)
}).then(done).then(done)
}).then(done)
})

it('normal elements with different keys, simultaneous', done => {
Expand Down
16 changes: 11 additions & 5 deletions test/unit/karma.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const webpackConfig = {
resolve: {
alias: alias,
extensions: ['.tsx', '.ts', '.js'],
fallback: {
'stream': require.resolve("stream-browserify")
}
},
plugins: [
new webpack.DefinePlugin({
Expand All @@ -32,17 +35,19 @@ const webpackConfig = {
}
})
],
devtool: '#inline-source-map'
devtool: 'inline-source-map'
}

// shared config for all unit tests
module.exports = {
frameworks: ['jasmine'],
frameworks: ['jasmine', 'webpack', 'karma-typescript'],
files: [
'./index.js'
'./index.js',
"src/**/*.ts" // *.tsx for React Jsx
],
preprocessors: {
'./index.js': ['webpack', 'sourcemap']
'./index.js': ['webpack', 'sourcemap'],
"**/*.ts": ["karma-typescript", 'webpack', 'sourcemap'] // *.tsx for React Jsx
},
webpack: webpackConfig,
webpackMiddleware: {
Expand All @@ -52,6 +57,7 @@ module.exports = {
'karma-jasmine',
'karma-mocha-reporter',
'karma-sourcemap-loader',
'karma-webpack'
'karma-webpack',
'karma-typescript'
]
}
2 changes: 1 addition & 1 deletion test/unit/karma.cover.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function (config) {
flags: ['--no-sandbox']
}
},
reporters: ['mocha', 'coverage'],
reporters: ['mocha', 'coverage', 'karma-typescript'],
coverageReporter: {
reporters: [
{ type: 'lcov', dir: '../../coverage', subdir: '.' },
Expand Down
Loading

0 comments on commit ee5243f

Please sign in to comment.