Skip to content

Commit 6d086d5

Browse files
authored
Merge pull request #29 from paleite/tests-in-ci-2
Run tests in CI
2 parents 2fd5f26 + 6ecf0dd commit 6d086d5

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

.github/workflows/eslint-plugin-diff.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
name: Run ESLint on your changes only
2+
23
on:
34
pull_request:
5+
paths-ignore:
6+
- "**.md"
7+
8+
env:
9+
HUSKY: 0
10+
411
jobs:
512
build:
613
runs-on: ubuntu-latest
714
steps:
815
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 16
19+
cache: "yarn"
920
- name: Install modules
10-
run: yarn
21+
run: yarn install --frozen-lockfile
1122
- name: Link the plugin
1223
run: |
1324
yarn link

.github/workflows/nodejs-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 2
1618
- uses: actions/setup-node@v3
1719
with:
1820
node-version: 16

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"version": "0.2",
3-
"words": ["ahmadnassri", "Eriksson", "paleite"],
3+
"words": ["ahmadnassri", "codecov", "Eriksson", "paleite"],
44
"ignoreWords": ["pinst", "Wercker"]
55
}

jest.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ module.exports = {
77
coveragePathIgnorePatterns: [".test-d.ts"],
88
coverageThreshold: {
99
global: {
10-
statements: 90,
11-
branches: 90,
12-
functions: 90,
13-
lines: 90,
10+
statements: 80,
11+
branches: 80,
12+
functions: 80,
13+
lines: 80,
1414
},
1515
},
1616
};

src/ci.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ const OLD_ENV = process.env;
33
beforeEach(() => {
44
jest.resetModules(); // Most important - it clears the cache
55
process.env = { ...OLD_ENV }; // Make a copy
6+
7+
// When running in CI, we want to avoid triggering the "Too many CI providers
8+
// found"-error, so we delete all known `diffBranch`-occurrences here.
9+
delete process.env.SYSTEM_PULLREQUEST_TARGETBRANCH;
10+
delete process.env.bamboo_repository_pr_targetBranch;
11+
delete process.env.BITBUCKET_PR_DESTINATION_BRANCH;
12+
delete process.env.BUDDY_EXECUTION_PULL_REQUEST_BASE_BRANCH;
13+
delete process.env.DRONE_TARGET_BRANCH;
14+
delete process.env.GITHUB_BASE_REF;
15+
delete process.env.APPVEYOR_PULL_REQUEST_NUMBER;
16+
delete process.env.APPVEYOR_REPO_BRANCH;
17+
delete process.env.CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME;
18+
delete process.env.TRAVIS_BRANCH;
619
});
720

821
describe("guessBranch", () => {

0 commit comments

Comments
 (0)