Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] some changes not picked up when using --change #987

Open
3 tasks done
MaelAbgrall opened this issue Dec 29, 2023 · 0 comments
Open
3 tasks done

[BUG] some changes not picked up when using --change #987

MaelAbgrall opened this issue Dec 29, 2023 · 0 comments
Labels
bug something not go good

Comments

@MaelAbgrall
Copy link

MaelAbgrall commented Dec 29, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?

  • yes I read the things

This issue exists in the latest tap version

  • I am using the latest tap

Description

Hello

I'm starting to learn tap, and the before/after config is important for me (I spin up an API server)

I found an edge case when using the --changed flag; if the previous tests all passed, Tap will not re-run the tests if the configuration file, or any before/after script has changed.

Reproduction

package.json

"tap": {
    "before": "beforeTests.ts"
  },
"scripts": {
    "test": "tap --changed",
  }

beforeTests.ts

console.log("log before tests");
// throw new Error("gotcha");

src/modules/search/foo.test.ts

import t from "tap";

t.test("this is a child test", (t) => {
  t.pass("whatever");
  t.end();
});

bash

yarn test ./src/modules/search/*

Step 1:

run the bash command, and let the tests succeed

Step 2:

un-comment the throw error in beforeTest.ts

Step 3:

run the same bash command, the tests will skip and not throw any error

Step 4:

change anything in the test file, and run the same bash command. since the test file has changed, the tests will be run again and the error from the beforeTests.ts will finally show

Environment

/usr/bin/tap
fastify@ /home/****/Documents/fastify
└── tap@18.6.1
tap: 18.6.1
"@tapjs/config": 2.4.14
"@tapjs/core": 1.4.6
"@tapjs/run": 1.4.16
"@tapjs/stack": 1.2.7
"@tapjs/test": 1.3.17
tap-parser: 15.3.1
tap-yaml: 2.2.1
tcompare: 6.4.5
plugins:
  "@tapjs/after": 1.1.17
  "@tapjs/after-each": 1.1.17
  "@tapjs/asserts": 1.1.17
  "@tapjs/before": 1.1.17
  "@tapjs/before-each": 1.1.17
  "@tapjs/filter": 1.2.17
  "@tapjs/fixture": 1.2.17
  "@tapjs/intercept": 1.2.17
  "@tapjs/mock": 1.2.15
  "@tapjs/node-serialize": 1.2.6
  "@tapjs/snapshot": 1.2.17
  "@tapjs/spawn": 1.1.17
  "@tapjs/stdin": 1.1.17
  "@tapjs/typescript": 1.3.6
  "@tapjs/worker": 1.1.17
# from .taprc
after: afterTests.ts
before: beforeTests.ts

# env, cli, and defaults
color: true
coverage-report:
  - text
exclude:
  - "**/@(fixture*(s)|dist)/**"
include:
  - "**/@(test?(s)|__test?(s)__)/**/*.@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
  - "**/*.@(test?(s)|spec).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
  - "**/test?(s).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
jobs: 3
reporter: base
snapshot-clean-cwd: true
timeout: 30
@tapjs/after
@tapjs/after-each
@tapjs/asserts
@tapjs/before
@tapjs/before-each
@tapjs/filter
@tapjs/fixture
@tapjs/intercept
@tapjs/mock
@tapjs/node-serialize
@tapjs/snapshot
@tapjs/spawn
@tapjs/stdin
@tapjs/typescript
@tapjs/worker

# if using typescript:
fastify@ /home/****/Documents/fastify
└─┬ tap@18.6.1
  ├─┬ @tapjs/test@1.3.17
  │ └── @isaacs/ts-node-temp-fork-for-pr-2009@10.9.5
  └─┬ @tapjs/typescript@1.3.6
    └── @isaacs/ts-node-temp-fork-for-pr-2009@10.9.5
fastify@ /home/****/Documents/fastify
├─┬ tap@18.6.1
│ ├─┬ @tapjs/test@1.3.17
│ │ ├─┬ @isaacs/ts-node-temp-fork-for-pr-2009@10.9.5
│ │ │ └── typescript@5.2.2 deduped
│ │ ├─┬ tshy@1.8.2
│ │ │ └── typescript@5.2.2
│ │ └── typescript@5.2.2
│ └─┬ @tapjs/typescript@1.3.6
│   └─┬ @isaacs/ts-node-temp-fork-for-pr-2009@10.9.5
│     └── typescript@5.2.2
└── typescript@5.3.3

# posix:
Linux ****** 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
@MaelAbgrall MaelAbgrall added the bug something not go good label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something not go good
Projects
None yet
Development

No branches or pull requests

1 participant