Skip to content

Commit

Permalink
test: add transform all tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 17, 2024
1 parent e6ff214 commit 3d8ec4b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ jobs:
node:
- '18'
- '20'
transform_all:
- 'true'
- 'false'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
Expand All @@ -242,6 +245,8 @@ jobs:
shell: bash
- name: Test bindings
run: pnpm test
env:
OXC_TRANSFORM_ALL: ${{ matrix.transform_all }}
test-linux-binding:
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
needs:
Expand Down
1 change: 1 addition & 0 deletions packages/integrate-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"ipaddr.js": "^2.2.0",
"postgres": "^3.4.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"simple-git": "^3.25.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/integrate-module/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { supportedExtensions } from 'file-type'
import { renderToString } from 'react-dom/server'
import { simpleGit } from 'simple-git'
import ipaddr from 'ipaddr.js'
import postgres from 'postgres'

import { CompiledClass } from './compiled.js'
import { foo } from './foo.mjs'
Expand Down Expand Up @@ -66,3 +67,8 @@ await test('resolve package.json', () => {
await test('resolve ipaddr.js', () => {
assert.ok(ipaddr.isValid('::1'))
})

await test('resolve postgres', () => {
const sql = postgres()
assert.ok(sql)
})
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,11 @@ fn transform_output(url: String, output: LoadFnOutput) -> Result<LoadFnOutput> {
}
Some(Either4::A(_) | Either4::B(_) | Either4::C(_)) => {
let src_path = Path::new(&url);
if env::var("OXC_TRANSFORM_ALL").is_err()
&& src_path
.to_str()
.map(|p| p.contains(NODE_MODULES_PATH))
.unwrap_or(false)
// url is a file path, so it's always unix style path separator in it
if env::var("OXC_TRANSFORM_ALL")
.map(|value| value.is_empty() || value == "0" || value == "false")
.is_err()
&& url.contains("/node_modules/")
{
tracing::debug!("Skip transforming node_modules {}", url);
return Ok(output);
Expand Down

0 comments on commit 3d8ec4b

Please sign in to comment.