Skip to content

Commit

Permalink
Tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
breville committed Sep 17, 2023
1 parent f3d5126 commit 2943b21
Show file tree
Hide file tree
Showing 6 changed files with 439 additions and 2,266 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
run: yarn
- name: Build
run: yarn run build
- name: Test
run: yarn run test

- name: Set up pages
run: mkdir pages && cp -r dist/* pages/ && cp index.html pages/
Expand Down
53 changes: 35 additions & 18 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
var webpack = require('webpack');

module.exports = config => {
config.set({
basePath: '',
frameworks: ['tap'],
frameworks: ['tap', 'webpack'],
files: [
{pattern: 'test/integration/index.js'},
{pattern: 'test/assets/sprite_sheets/**/*.*', watched: false, included: false, served: true},
{
pattern: 'test/assets/sprite_sheets/**/*.*',
watched: false,
included: false,
served: true,
},
],
preprocessors: {
'test/integration/*.js': ['webpack', 'sourcemap'],
},
webpack: {
mode: 'development',
node: {
fs: 'empty',
},
module: {
rules: [{
enforce: 'post',
test: /\.js$/,
exclude: [
/(test|node_modules)\//,
'src/p5.dance.interpreted.js',
],
loader: 'istanbul-instrumenter-loader'
}]
}
rules: [
{
enforce: 'post',
test: /\.js$/,
exclude: [
/(test|node_modules)\//,
/.*src\/p5.dance.interpreted.js/,
],
loader: 'coverage-istanbul-loader',
},
],
},
resolve: {
fallback: {
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
fs: false,
},
extensions: ['.jsx', '.js', '.tsx', '.ts'],
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
},
reporters: ['tap-pretty', 'coverage'],

Expand All @@ -40,9 +59,7 @@ module.exports = config => {
// Code coverage.
coverageReporter: {
dir: 'coverage/integration',
reporters: [
{type: 'lcovonly'},
],
reporters: [{type: 'lcovonly'}],
},
});
};
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
"dev": "webpack-dev-server --mode=development --host=0.0.0.0",
"codecov": "mkdir -p coverage && nyc report --reporter=text-lcov > ./coverage/unit.lcov && codecov",
"lint": "eslint --ext .js src test",
"test": "npm run lint && nyc npm run test:unit && npm run test:integration && npm run test:visual",
"test": "yarn run lint && nyc yarn run test:unit && yarn run test:integration && yarn run test:visual",
"test:unit": "tape ./test/unit/*.js",
"test:visual": "tape ./test/visual/*.js",
"test:integration": "karma start",
"preversion": "npm install && npm run test",
"version": "npm run build",
"postversion": "git push && git push --tags && npm publish"
"preversion": "yarn install && yarn run test",
"version": "yarn run build",
"postversion": "git push && git push --tags && yarn publish"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/code-dot-org/dance-party.git"
},
"engines": {
"npm": ">=6.14.13",
"node": ">=14.17.1"
"node": "^18.16.0",
"npm": "^9.5.1"
},
"author": "",
"license": "Apache-2.0",
Expand All @@ -33,24 +33,28 @@
"@code-dot-org/p5.play": "^1.3.14-cdo",
"babel-loader": "^8.0.6",
"babelify": "^6.3.0",
"buffer": "^6.0.3",
"canvas": "^2.11.2",
"codecov": "^3.1.0",
"coverage-istanbul-loader": "^3.0.5",
"data-urls": "^1.1.0",
"eslint": "^2.8.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jsdom": "^19.0.0",
"karma": "^2.0.5",
"karma": "^6.4.2",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-tap": "^4.1.4",
"karma-tap-pretty-reporter": "^4.1.0",
"karma-webpack": "^5.0.0",
"nyc": "^13.1.0",
"path-browserify": "^1.0.1",
"pixelmatch": "^4.0.2",
"pngjs": "^3.3.3",
"process": "^0.11.10",
"raw-loader": "^0.5.1",
"sinon": "^7.1.1",
"stream-browserify": "^3.0.0",
"tape": "^4.9.1",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
Expand Down
3 changes: 3 additions & 0 deletions test/integration/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//const process = require('process');


require('./effectsLevelTest');
require('./hourOfCodeTest');
require('./spriteDanceTest');
10 changes: 6 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ module.exports = {
libraryTarget: 'umd',
},
module: {
rules: [{
test: /\.js$/,
loader: "babel-loader",
}],
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
},
],
},
};
Loading

0 comments on commit 2943b21

Please sign in to comment.