Skip to content

Commit

Permalink
#146: only tests module resolution 16 if not windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Jan 13, 2025
1 parent 90085d7 commit cd9f640
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: build

on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
Expand All @@ -14,16 +20,24 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
- name: npm install, build, and linting
run: |
npm install
npm run build --if-present
npm test
npm run lint
npm run test:ts
env:
CI: true
- name: test nodeResolution 16
if: runner.os != 'Windows'
run: |
npm run test:16
- name: cases
run: |
npm run test:cases
- name: upload to codecov
if: runner.os == 'Linux'
uses: codecov/codecov-action@v5
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,6 @@ ignore({

# Upgrade Guide

## Upgrade 5.x -> 6.x

To bring better compatibility for TypeScript with `moduleResolution:Node16`, `ignore.isPathValid` has been removed in TypeScript definitions since `6.x`

```js
// < 6, or works with commonjs
ignore.isPathValid('./foo') // false

// >= 6.x
import {isPathValid} from 'ignore'

isPathValid('./foo') // false
```

## Upgrade 4.x -> 5.x

Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,28 @@
"scripts": {
"prepublishOnly": "npm run build",
"build": "babel -o legacy.js index.js",
"test:lint": "eslint .",

"==================== linting ======================": "",
"lint": "eslint .",

"=================== typescript ====================": "",
"ts": "npm run test:ts && npm run test:16",
"test:ts": "ts-node ./test/ts/simple.ts",
"test:16": "npm run test:ts:16 && npm run test:cjs:16 && npm run test:mjs:16",
"test:ts:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/ts/simple.ts",
"test:cjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/ts/simple.cjs",
"test:mjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/ts/simple.mjs",

"===================== cases =======================": "",
"test:cases": "npm run tap test/*.test.js -- --coverage",
"tap": "tap --reporter classic",
"test:git": "npm run tap test/git-check-ignore.test.js",
"test:ignore": "npm run tap test/ignore.test.js",
"test:ignore:only": "IGNORE_ONLY_IGNORES=1 npm run tap test/ignore.test.js",
"test:others": "npm run tap test/others.test.js",
"test:cases": "npm run tap test/*.test.js -- --coverage",
"test:no-coverage": "npm run tap test/*.test.js -- --no-check-coverage",
"test:only": "npm run test:lint && npm run build && npm run test:ts && npm run test:ts:16 && npm run test:cjs:16 && npm run test:mjs:16 && npm run test:cases",
"test": "npm run test:only",

"test": "npm run lint && npm run ts && npm run build && npm run test:cases",
"test:win32": "IGNORE_TEST_WIN32=1 npm run test",
"report": "tap --coverage-report=html"
},
Expand Down

0 comments on commit cd9f640

Please sign in to comment.