Skip to content

Commit

Permalink
Merge branch 'v4-hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Aug 26, 2022
2 parents f4067b2 + 7c48c4d commit 14061be
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 295 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Upgrade npm
run: npm install --global npm@^8.12
run: npm install --global npm@^8.18
- run: npm install --no-audit
- run: npm run cover
- uses: codecov/codecov-action@v2
Expand All @@ -50,7 +50,7 @@ jobs:
node-version: ^18
cache: npm
- name: Upgrade npm
run: npm install --global npm@^8.12
run: npm install --global npm@^8.18
- run: npm install --no-audit
- run: npm i typescript@${TS_VERSION}
env:
Expand All @@ -68,7 +68,7 @@ jobs:
node-version: ^18
cache: npm
- name: Upgrade npm
run: if [[ "$(npm -v)" != "8.12.0" ]]; then npm install --global npm@8.12.0; fi
run: if [[ "$(npm -v)" != "8.18.0" ]]; then npm install --global npm@8.18.0; fi
- run: npm install --no-audit
- name: Test package-lock for unexpected modifications
run: |
Expand All @@ -89,7 +89,7 @@ jobs:
with:
node-version: ^18
- name: Upgrade npm
run: npm install --global npm@^8.12
run: npm install --global npm@^8.18
- run: npm install --no-package-lock --no-audit
- run: npm run cover

Expand All @@ -103,6 +103,6 @@ jobs:
node-version: ^18
cache: npm
- name: Upgrade npm
run: npm install --global npm@^8.12
run: npm install --global npm@^8.18
- run: npm install --no-audit
- run: npx xo
1 change: 1 addition & 0 deletions .xo-config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
{
files: 'examples/**',
rules: {
'ava/no-ignored-test-files': 'off',
'ava/no-only-test': 'off',
'unicorn/prefer-module': 'off',
},
Expand Down
12 changes: 9 additions & 3 deletions lib/worker/line-numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function findTest(locations, declaration) {
const range = (start, end) => Array.from({length: end - start + 1}).fill(start).map((element, index) => element + index);

const translate = (sourceMap, pos) => {
if (sourceMap === undefined) {
if (sourceMap === null) {
return pos;
}

Expand All @@ -88,7 +88,7 @@ export default function lineNumberSelection({file, lineNumbers = []}) {

let locations = parse(file);
let lookedForSourceMap = false;
let sourceMap;
let sourceMap = null;

return () => {
if (!lookedForSourceMap) {
Expand All @@ -98,7 +98,13 @@ export default function lineNumberSelection({file, lineNumbers = []}) {
// Source maps are not available before then.
sourceMap = findSourceMap(file);

if (sourceMap !== undefined) {
if (sourceMap === undefined) {
// Prior to Node.js 18.8.0, the value when a source map could not be found was `undefined`.
// This changed to `null` in <https://github.com/nodejs/node/pull/43875>.
sourceMap = null;
}

if (sourceMap !== null) {
locations = locations.map(({start, end}) => ({
start: translate(sourceMap, start),
end: translate(sourceMap, end),
Expand Down
Loading

0 comments on commit 14061be

Please sign in to comment.