Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tests and reporting to jest #216

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- run: yarn install --network-timeout 1000000 --frozen-lockfile
- run: yarn run build-views
- run: yarn test
- run: yarn run coverage

- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
directory: ./coverage
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
collectCoverage: true,
coverageReporters: ['text', 'lcov'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
'/node_modules/',
'/test/',
'/coverage/',
'/src/directory.js',
'/src/error.js'
]
};
20 changes: 8 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "yarn run test-lint && yarn run test-integration",
"test-lint": "zeit-eslint --ext .jsx,.js .",
"test-integration": "nyc --reporter=html --reporter=text ava test/integration.js",
"test-integration": "jest --forceExit test/integration.test.js",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov",
"lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint",
"build-views": "dottojs -s ./src -d ./src",
Expand All @@ -29,29 +29,24 @@
"devDependencies": {
"@zeit/eslint-config-node": "0.2.13",
"@zeit/git-hooks": "0.1.4",
"ava": "2.2.0",
"commander": "2.15.1",
"dot": "1.1.3",
"eslint": "6.1.0",
"fs-extra": "6.0.1",
"jest": "29.7.0",
"micro": "9.3.2",
"node-fetch": "2.6.1",
"nyc": "14.1.1",
"request": "2.87.0",
"sleep-promise": "6.0.0",
"test-listen": "1.1.0"
},
"eslintConfig": {
"extends": [
"@zeit/eslint-config-node"
]
},
"nyc": {
"exclude": [
"src/directory.js",
"src/error.js",
"test/*"
]
],
"env": {
"jest": true
}
},
"eslintIgnore": [
"error.js",
Expand All @@ -69,5 +64,6 @@
"path-is-inside": "1.0.2",
"path-to-regexp": "2.2.1",
"range-parser": "1.2.0"
}
},
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
}
2 changes: 1 addition & 1 deletion src/glob-slash.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This is adopted from https://github.com/scottcorgan/glob-slash/

const path = require('path');
const path = require('node:path');
const normalize = value => path.posix.normalize(path.posix.join('/', value));

module.exports = value => (value.charAt(0) === '!' ? `!${normalize(value.substr(1))}` : normalize(value));
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Native
const {promisify} = require('util');
const path = require('path');
const {createHash} = require('crypto');
const {realpath, lstat, createReadStream, readdir} = require('fs');
const {promisify} = require('node:util');
const path = require('node:path');
const {createHash} = require('node:crypto');
const {realpath, lstat, createReadStream, readdir} = require('node:fs');

// Packages
const url = require('url');
const url = require('node:url');
const slasher = require('./glob-slash');
const minimatch = require('minimatch');
const pathToRegExp = require('path-to-regexp');
Expand Down
Loading
Loading