-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add karma test for file cache
- Loading branch information
Showing
12 changed files
with
140 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
const path = require('path'); | ||
// const os = require('os'); | ||
const { AureliaPlugin } = require('aurelia-webpack-plugin'); | ||
|
||
module.exports = (config) => { | ||
config.set({ | ||
basePath: '', | ||
|
||
preprocessors: { | ||
// add webpack as preprocessor | ||
'test/**/*.test.ts': ['webpack', 'sourcemap'] | ||
}, | ||
|
||
// make sure to include webpack as a framework | ||
frameworks: ['mocha', 'webpack'], | ||
|
||
plugins: [ | ||
'karma-mocha', | ||
'karma-webpack', | ||
'karma-chrome-launcher', | ||
'karma-sourcemap-loader', | ||
], | ||
|
||
files: [ | ||
{ pattern: 'src/**/*.ts', included: false, served: true, watched: false, nocache: false }, | ||
{ pattern: 'test/**/*.test.ts', watched: false }, | ||
], | ||
|
||
browsers: ['ChromeHeadless'], | ||
mime: { | ||
"text/x-typescript": ["ts"] | ||
}, | ||
mochaReporter: { | ||
ignoreSkipped: true | ||
}, | ||
|
||
webpack: webpackConfig(), | ||
}); | ||
} | ||
|
||
/** | ||
* @returns {import('webpack').Configuration} | ||
*/ | ||
function webpackConfig() { | ||
return { | ||
mode: 'development', | ||
// target: ['es5'], | ||
// output: { | ||
// filename: 'app.js', | ||
// path: path.join(os.tmpdir(), '_karma_webpack_') + Math.floor(Math.random() * 1000000), | ||
// }, | ||
stats: { | ||
modules: false, | ||
colors: true, | ||
}, | ||
resolve: { | ||
extensions: [".js", ".ts"], | ||
alias: { | ||
src: path.join(__dirname, 'src') | ||
}, | ||
modules: ['node_modules'] | ||
}, | ||
watch: true, | ||
devtool: 'inline-source-map', | ||
optimization: { | ||
runtimeChunk: 'single', | ||
splitChunks: { | ||
chunks: 'all', | ||
minSize: 0, | ||
cacheGroups: { | ||
commons: { | ||
name: 'commons', | ||
chunks: 'initial', | ||
minChunks: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
loader: "ts-loader", | ||
exclude: /node_modules/, | ||
options: { | ||
compilerOptions: { | ||
target: 'es5' | ||
} | ||
} | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'html-loader' | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new AureliaPlugin({ | ||
aureliaApp: undefined | ||
}), | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'aurelia-polyfills'; | ||
import 'aurelia-loader-webpack'; | ||
import { bootstrap } from 'aurelia-bootstrapper'; | ||
import { StageComponent } from 'aurelia-testing'; | ||
import { assert } from 'chai'; | ||
import { PLATFORM } from 'aurelia-pal'; | ||
|
||
describe('app-filesystem-cache/app.test.ts', function () { | ||
it('works', async function () { | ||
const component = StageComponent | ||
.withResources([PLATFORM.moduleName('src/app')]) | ||
.inView('<app >') | ||
.boundTo({ }); | ||
await component.create(bootstrap); | ||
|
||
assert.include(component.element.textContent.trim(), 'Test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters