Skip to content

Renew jest #1718

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

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export default {
import { createDefaultPreset } from "ts-jest";

/** @type {import("ts-jest").JestConfigWithTsJest} */
const config = {
moduleFileExtensions: ["ts", "js"],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
globals: {
"ts-jest": {
tsconfig: "tsconfig.json",
},
...createDefaultPreset().transform,
},
collectCoverageFrom: ["src/**/*.ts"],
setupFilesAfterEnv: ["./tests/jest-setup.ts"],
testMatch: ["**/tests/**/*.test.ts"],
};

export default config;
40 changes: 20 additions & 20 deletions tests/codeBlock/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Code Block Bulleted code block 1`] = `
Array [
Object {
[
{
"content": "function () {
alert(document.location.href)
console.log(\\"hello\\")
console.log("hello")
// You can also write comments!
}",
"fileName": "hello.js",
Expand All @@ -16,32 +16,32 @@ Array [
`;

exports[`Code Block Code block with bullet 1`] = `
Array [
Object {
[
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "Bullet",
"text": "Bullet",
"type": "plain",
},
],
"type": "line",
},
Object {
{
"content": "function () {
alert(document.location.href)
console.log(\\"hello\\")
console.log("hello")
// You can also write comments!
}",
"fileName": "hello.js",
"indent": 1,
"type": "codeBlock",
},
Object {
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "Bullet",
"text": "Bullet",
"type": "plain",
Expand All @@ -53,21 +53,21 @@ Array [
`;

exports[`Code Block Consecutive code blocks 1`] = `
Array [
Object {
[
{
"content": "function () {
alert(document.location.href)
console.log(\\"hello\\")
console.log("hello")
// You can also write comments!
}",
"fileName": "hello.js",
"indent": 0,
"type": "codeBlock",
},
Object {
{
"content": "function () {
alert(document.location.href)
console.log(\\"hello\\")
console.log("hello")
// You can also write comments!
}",
"fileName": "hello.js",
Expand All @@ -78,11 +78,11 @@ Array [
`;

exports[`Code Block Simple code block 1`] = `
Array [
Object {
[
{
"content": "function () {
alert(document.location.href)
console.log(\\"hello\\")
console.log("hello")
// You can also write comments!
}",
"fileName": "hello.js",
Expand Down
64 changes: 32 additions & 32 deletions tests/line/__snapshots__/blank.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`blank [] is not blank 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[]",
"text": "[]",
"type": "plain",
Expand All @@ -17,21 +17,21 @@ Array [
`;

exports[`blank Blank in the [*** ] 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[*** ",
"text": "[*** ",
"type": "plain",
},
Object {
{
"raw": "[ ]",
"text": " ",
"type": "blank",
},
Object {
{
"raw": "]",
"text": "]",
"type": "plain",
Expand All @@ -43,21 +43,21 @@ Array [
`;

exports[`blank Blank in the sentence 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "sentence",
"text": "sentence",
"type": "plain",
},
Object {
{
"raw": "[ ]",
"text": " ",
"type": "blank",
},
Object {
{
"raw": "sentence",
"text": "sentence",
"type": "plain",
Expand All @@ -69,11 +69,11 @@ Array [
`;

exports[`blank Multi char blank 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[     ]",
"text": "     ",
"type": "blank",
Expand All @@ -85,11 +85,11 @@ Array [
`;

exports[`blank Simple double-byte space blank 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[ ]",
"text": " ",
"type": "blank",
Expand All @@ -101,11 +101,11 @@ Array [
`;

exports[`blank Simple half-space blank 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[ ]",
"text": " ",
"type": "blank",
Expand All @@ -117,11 +117,11 @@ Array [
`;

exports[`blank Simple tab blank 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "[ ]",
"text": " ",
"type": "blank",
Expand Down
50 changes: 25 additions & 25 deletions tests/line/__snapshots__/bullet.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`bullet Double-byte space indent 1`] = `
Array [
Object {
[
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "Double-byte space",
"text": "Double-byte space",
"type": "plain",
Expand All @@ -17,44 +17,44 @@ Array [
`;

exports[`bullet Multi lines bullet 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "no bullet (indent: 0)",
"text": "no bullet (indent: 0)",
"type": "plain",
},
],
"type": "line",
},
Object {
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "first bullet (indent: 1)",
"text": "first bullet (indent: 1)",
"type": "plain",
},
],
"type": "line",
},
Object {
{
"indent": 2,
"nodes": Array [
Object {
"nodes": [
{
"raw": "second bullet (indent: 2)",
"text": "second bullet (indent: 2)",
"type": "plain",
},
],
"type": "line",
},
Object {
{
"indent": 3,
"nodes": Array [
Object {
"nodes": [
{
"raw": "third bullet (indent: 3)",
"text": "third bullet (indent: 3)",
"type": "plain",
Expand All @@ -66,11 +66,11 @@ Array [
`;

exports[`bullet Single-byte space indent 1`] = `
Array [
Object {
[
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "Single-byte space",
"text": "Single-byte space",
"type": "plain",
Expand All @@ -82,11 +82,11 @@ Array [
`;

exports[`bullet Tab indent 1`] = `
Array [
Object {
[
{
"indent": 1,
"nodes": Array [
Object {
"nodes": [
{
"raw": "Tab",
"text": "Tab",
"type": "plain",
Expand Down
16 changes: 8 additions & 8 deletions tests/line/__snapshots__/code.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`code Empty code with backquote 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "\`\`",
"text": "",
"type": "code",
Expand All @@ -17,11 +17,11 @@ Array [
`;

exports[`code Simple code with backquote 1`] = `
Array [
Object {
[
{
"indent": 0,
"nodes": Array [
Object {
"nodes": [
{
"raw": "\`Simple code\`",
"text": "Simple code",
"type": "code",
Expand Down
Loading
Loading