Skip to content

Commit

Permalink
WIP running test cases with bun
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 2, 2025
1 parent 5321f30 commit 2f55bb7
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-bun-loaders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: yarn install --frozen-lockfile && yarn lerna bootstrap

- name: Test
run: bun run test:loaders
run: bun run --bun test:bun:loaders

- name: Build
run: bun run build
run: bun run --bun build
6 changes: 3 additions & 3 deletions .github/workflows/ci-bun.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Continous Integration - Bun
name: Continuous Integration - Bun
on:
pull_request:
branches: master
Expand All @@ -19,7 +19,7 @@ jobs:
run: yarn install --frozen-lockfile && yarn lerna bootstrap

- name: Test
run: bun run test
run: bun run --bun test:bun

- name: Build
run: bun run build
run: bun run --bun build
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 c8 mocha --exclude \"./packages/**/test/cases/loaders-*/**\" \"./packages/**/**/*.spec.js\"",
"test:loaders": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --loader $(pwd)/test/test-loader.js ./node_modules/mocha/bin/mocha \"./packages/**/**/*.spec.js\"",
"test:loaders:win": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --loader file:\\\\%cd%\\test\\test-loader.js ./node_modules/mocha/bin/mocha --exclude \"./packages/init/test/cases/**\" \"./packages/**/**/*.spec.js\"",
"test:bun": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 mocha --timeout 360000 --exclude \"./packages/**/test/cases/loaders-*/**\" \"./packages/**/**/*.spec.js\"",
"test:tdd": "yarn test --watch",
"lint:js": "eslint \"*.js\" \"./packages/**/**/*.js\" \"./test/*.js\" \"./www/**/**/*.js\"",
"lint:ts": "eslint \"./packages/**/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/layout-utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable complexity */
import fs from 'fs/promises';
import htmlparser from 'node-html-parser';
import * as htmlparser from 'node-html-parser';
import { checkResourceExists } from './resource-utils.js';
import { Worker } from 'worker_threads';
import { asyncFilter } from './async-utils.js';
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/lib/resource-utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs/promises';
import { hashString } from './hashing-utils.js';
import { getResolvedHrefFromPathnameShortcut } from '../lib/node-modules-utils.js';
import htmlparser from 'node-html-parser';
import * as htmlparser from 'node-html-parser';
import { asyncMap } from './async-utils.js';

async function modelResource(context, type, src = undefined, contents = undefined, optimizationAttr = undefined, rawAttributes = undefined) {
Expand Down Expand Up @@ -78,6 +78,10 @@ function normalizePathnameForWindows(url) {
}

async function checkResourceExists(url) {
if (url.pathname === '/') {
return false;
}

try {
await fs.access(url);
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/plugins/resource/plugin-standard-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getUserScripts, getPageLayout, getAppLayout } from '../../lib/layout-ut
import { requestAsObject } from '../../lib/resource-utils.js';
import unified from 'unified';
import { Worker } from 'worker_threads';
import htmlparser from 'node-html-parser';
import * as htmlparser from 'node-html-parser';

class StandardHtmlResource extends ResourceInterface {
constructor(compilation, options) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-css-modules/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/
import fs from 'fs';
import htmlparser from 'node-html-parser';
import * as htmlparser from 'node-html-parser';
import { parse, walk } from 'css-tree';
import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js';
import * as acornWalk from 'acorn-walk';
Expand Down

0 comments on commit 2f55bb7

Please sign in to comment.