Skip to content

Commit

Permalink
Switch ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Feb 16, 2024
1 parent abd6245 commit 1cfc484
Show file tree
Hide file tree
Showing 12 changed files with 55,075 additions and 46,651 deletions.
34 changes: 17 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"rules": {
"max-len": 1
}
}
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"rules": {
"max-len": 1
}
}
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,27 @@ We can use [npm][3] or [yarn][4] to build this action.

```bash
npm i -g yarn
yarn install
yarn run build
yarn install # or pnpm install
yarn run build # or pnpm run build

# commit
git add lib/* src/*
git commit -m "COMMIT MESSAGE"
```

```bash
# test with bash
env NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" yarn run test
env NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" pnpm run test
```

```powershell
# test with powershell
$ENV:NODE_OPTIONS="$ENV:NODE_OPTIONS --experimental-vm-modules"
yarn run test # or pnpm run test
```

### Reference

| title | link |
Expand Down
15 changes: 14 additions & 1 deletion __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import micromatch from 'micromatch';
import mime from "mime/lite";
import { globby } from "globby";
import { env } from "string-env-interpolation";
import * as path from "path";

import * as lib from '../src/index';


test('Test delete_file rule', () => {
const delete_files_pattern = "random-name-*.txt;random-*.txt".split(";")
.map((v) => v.trim())
Expand All @@ -16,4 +20,13 @@ test('Test delete_file rule', () => {
test('Test parse var with env', () => {
expect (env('${PATH}') == '${PATH}').toBe(false);
expect (env('$PATH')).toBe('$PATH');
});
});

test('Test mime', () => {
expect (mime.getType(path.extname("test.png"))).toBe('image/png');
});

test('Test globby', async () => {
const select_files = await globby("*.md", { absolute: true, onlyFiles: true });
expect (path.basename(select_files[0])).toBe('README.md');
});
11 changes: 0 additions & 11 deletions jest.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { JestConfigWithTsJest } from 'ts-jest'
// import { defaults } from "jest-config";
import { jsWithTsESM } from "ts-jest/presets";

const config: JestConfigWithTsJest = {
...jsWithTsESM,
clearMocks: true,
verbose: true,
};

export default config;

0 comments on commit 1cfc484

Please sign in to comment.