Skip to content

Commit

Permalink
use node:test in postcss-tape (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke authored Dec 26, 2023
1 parent a1755b6 commit b15603c
Show file tree
Hide file tree
Showing 200 changed files with 2,051 additions and 2,435 deletions.
2 changes: 1 addition & 1 deletion .github/bin/new-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ console.log(`- Creating new plugin ${pluginName}`);
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'src', 'index.ts'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'test', '_import.mjs'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'test', '_require.cjs'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, '.tape.mjs'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'test', '_tape.mjs'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'README.md'));
await replaceBasePluginReferencesForFilePath(path.join(pluginDir, 'INSTALL.md'));
await fsp.writeFile(
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:

- name: npm ci
run: |
npm ci --ignore-scripts
npm ci
env:
BROWSER_TESTS: true
if: ${{ (matrix.is_base_node_version && matrix.is_base_os_version) }}

- name: npm ci
Expand Down Expand Up @@ -85,14 +87,6 @@ jobs:
NPM_CONFIG_ENGINE_STRICT=false npm install --ignore-scripts
npm run test:cli --if-present $MODIFIED_WORKSPACES
# Browser Tests
# running "npm ci" again, but allowing scripts so that Chrome is installed
- name: test:browser
run: |
npm ci
npm run test:browser --if-present $MODIFIED_WORKSPACES
if: matrix.is_base_node_version && matrix.is_base_os_version

# E2E Tests
- name: test:e2e
run: |
Expand Down
4 changes: 2 additions & 2 deletions experimental/css-has-pseudo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"stryker": "stryker run --logLevel error",
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
"test": "node --test",
"test:rewrite-expects": "REWRITE_EXPECTS=true node --test"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/experimental/css-has-pseudo#readme",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { postcssTape } from '@csstools/postcss-tape';
import plugin from '@csstools/css-has-pseudo-experimental';

postcssTape(plugin)({
postcssTape(plugin, { skipPackageNameCheck: true })({
'basic': {
message: 'supports basic usage',
warnings: 1
warnings: 1,
},
});
4 changes: 2 additions & 2 deletions experimental/postcss-gradient-stop-increments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
"test": "node --test",
"test:rewrite-expects": "REWRITE_EXPECTS=true node --test"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradient-stop-increments#readme",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import plugin from '@csstools/postcss-gradient-stop-increments-experimental';

postcssTape(plugin)({
basic: {
message: "supports basic usage",
message: 'supports basic usage',
},
'examples/example': {
message: 'minimal example',
},
'examples/example:preserve-true': {
message: 'minimal example',
options: {
preserve: true
}
preserve: true,
},
},
});
4 changes: 2 additions & 2 deletions experimental/postcss-nesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run build && npm run test",
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
"test": "node --test",
"test:rewrite-expects": "REWRITE_EXPECTS=true node --test"
},
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const mixinPluginRule = () => {
node.replaceWith(postcss.parse('& .in{ &.deep { color: blue; }}', {from : 'mixin.css'}));
},
},
}
}
};
};

mixinPluginRule.postcss = true
mixinPluginRule.postcss = true;

const mixinPluginDeclaration = () => {
return {
Expand All @@ -22,10 +22,10 @@ const mixinPluginDeclaration = () => {
node.replaceWith(postcss.parse('color: blue;', {from : 'mixin.css'}));
},
},
}
}
};
};

mixinPluginDeclaration.postcss = true
mixinPluginDeclaration.postcss = true;

postcssTape(plugin)({
'basic': {
Expand Down Expand Up @@ -54,7 +54,7 @@ postcssTape(plugin)({
},
'invalid-selector': {
message: 'warns on invalid selectors',
warnings: 2
warnings: 2,
},
'media': {
message: 'supports nested @media',
Expand All @@ -80,11 +80,11 @@ postcssTape(plugin)({
},
'mixin-declaration': {
message: 'supports other visitors (mixin declaration)',
plugins: [mixinPluginDeclaration(), plugin()]
plugins: [mixinPluginDeclaration(), plugin()],
},
'mixin-rule': {
message: 'supports other visitors (mixin rule)',
plugins: [mixinPluginRule(), plugin()]
plugins: [mixinPluginRule(), plugin()],
},
'spec-examples': {
message: 'supports all spec examples',
Expand All @@ -98,5 +98,5 @@ postcssTape(plugin)({
},
'ampersand-everywhere': {
message: 'allow & to be used everywhere',
}
},
});
33 changes: 7 additions & 26 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
},
"packages/*": {
"entry": [
".tape.{cjs,mjs}",
"scripts/**/*.mjs",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs",
"test/test.mjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.{ts,js,mjs}",
Expand All @@ -23,10 +20,8 @@
},
"plugins/postcss-design-tokens": {
"entry": [
".tape.{cjs,mjs}",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.ts",
Expand All @@ -38,10 +33,8 @@
},
"plugins/postcss-global-data": {
"entry": [
".tape.{cjs,mjs}",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.ts",
Expand All @@ -53,15 +46,12 @@
},
"plugins/*": {
"entry": [
".tape.{cjs,mjs}",
"scripts/**/*.mjs",
"src/browser-global.js",
"src/browser.js",
"src/index.js",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs",
"test/test.mjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.{ts,js,mjs}",
Expand All @@ -70,15 +60,12 @@
},
"experimental/*": {
"entry": [
".tape.{cjs,mjs}",
"scripts/**/*.mjs",
"src/browser-global.js",
"src/browser.js",
"src/index.js",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs",
"test/test.mjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.{ts,js,mjs}",
Expand All @@ -87,11 +74,8 @@
},
"plugin-packs/postcss-bundler": {
"entry": [
".tape.{cjs,mjs}",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs",
"test/test.mjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.ts",
Expand All @@ -105,12 +89,9 @@
},
"plugin-packs/*": {
"entry": [
".tape.{cjs,mjs}",
"scripts/**/*.mjs",
"src/index.ts",
"test/_import.mjs",
"test/_require.cjs",
"test/test.mjs"
"test/**/*.{cjs,mjs}"
],
"project": [
"**/*.{ts,js,mjs}",
Expand Down
Loading

0 comments on commit b15603c

Please sign in to comment.