Skip to content

tmp: trigger tests #1

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions test/tests/extras.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,20 @@ describe(`Extra Tests`, () => {
});

describe(`ts-node register script`, () => {
/** Yarn sometimes outputs bold text, which makes these tests flakey */
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves local tests failing:

 FAIL  tests/extras.test.ts (8.413 s)
  ● Extra Tests › Built Tests › ts-node register script › Works with --transpileOnly

    expect(received).toMatch(expected)

    Expected pattern: /^null($|\r?\n)/m
    Received string:  "null
    "

      37 |       test(`Works with --transpileOnly`, () => {
      38 |         const res = execSync("yarn g:ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString();
    > 39 |         expect(res).toMatch(/^null($|\r?\n)/m);
         |                     ^
      40 |       });
      41 |
      42 |       test(`Works with --typeCheck`, () => {

      at Object.<anonymous> (tests/extras.test.ts:39:21)

  ● Extra Tests › Built Tests › ts-node register script › Works with --typeCheck

    expect(received).toMatch(expected)

    Expected pattern: /^null($|\r?\n)/
    Received string:  "null
    "

      42 |       test(`Works with --typeCheck`, () => {
      43 |         const res = execSync("yarn g:ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString();
    > 44 |         expect(res).toMatch(/^null($|\r?\n)/);
         |                     ^
      45 |       });
      46 |     });
      47 |   });

      at Object.<anonymous> (tests/extras.test.ts:44:21)

function stripAnsi(str: string) {
// eslint-disable-next-line no-control-regex
return str.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
}

test(`Works with --transpileOnly`, () => {
const res = execSync("yarn g:ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString();
expect(res).toMatch(/^null($|\r?\n)/m);
expect(stripAnsi(res.trim())).toEqual("null");
});

test(`Works with --typeCheck`, () => {
const res = execSync("yarn g:ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString();
expect(res).toMatch(/^null($|\r?\n)/);
expect(stripAnsi(res.trim())).toEqual("null");
});
});
});
Expand Down