diff --git a/packages/contented-example/contented.config.mjs b/packages/contented-example/contented.config.mjs index 9202174e..db817ec0 100644 --- a/packages/contented-example/contented.config.mjs +++ b/packages/contented-example/contented.config.mjs @@ -73,7 +73,7 @@ const config = { { type: 'Contented', dir: 'packages/contented-example', - pattern: 'jest/**/*.md.unit.[tj]s', + pattern: 'jest/**/*.md.[tj]s', processor: 'jest-md', transform: (file) => { file.sections = file.sections.slice(1); diff --git a/packages/contented-example/jest/Pipelines/100-JestMarkdown.md.unit.ts b/packages/contented-example/jest/Pipelines/100-JestMarkdown.md.ts similarity index 100% rename from packages/contented-example/jest/Pipelines/100-JestMarkdown.md.unit.ts rename to packages/contented-example/jest/Pipelines/100-JestMarkdown.md.ts diff --git a/packages/contented-example/jest/Pipelines/200-JestMarkdownJs.md.unit.js b/packages/contented-example/jest/Pipelines/200-JestMarkdownJs.md.js similarity index 100% rename from packages/contented-example/jest/Pipelines/200-JestMarkdownJs.md.unit.js rename to packages/contented-example/jest/Pipelines/200-JestMarkdownJs.md.js diff --git a/packages/contented-example/jest/package.json b/packages/contented-example/jest/package.json index e26bc4ca..f82eb216 100644 --- a/packages/contented-example/jest/package.json +++ b/packages/contented-example/jest/package.json @@ -26,7 +26,7 @@ }, "jest": { "preset": "@contentedjs/jest-preset", - "testRegex": ".*\\.md\\.unit.[jt]s$" + "testRegex": ".*\\.md\\.[jt]s$" }, "devDependencies": { "@contentedjs/jest-preset": "0.0.0" diff --git a/packages/contented-pipeline-jest-md/src/JestMarkdownPipeline.ts b/packages/contented-pipeline-jest-md/src/JestMarkdownPipeline.ts index 72d5af5b..575a4c80 100644 --- a/packages/contented-pipeline-jest-md/src/JestMarkdownPipeline.ts +++ b/packages/contented-pipeline-jest-md/src/JestMarkdownPipeline.ts @@ -1,5 +1,5 @@ import { readFile } from 'node:fs/promises'; -import { join, ParsedPath } from 'node:path'; +import { join } from 'node:path'; import { parse } from '@babel/parser'; import { File } from '@babel/types'; @@ -7,13 +7,9 @@ import { MarkdownPipeline, MarkdownVFile } from '@contentedjs/contented-pipeline import stripIndent from 'strip-indent'; export class JestMarkdownPipeline extends MarkdownPipeline { - /** - * The file should be named as `file.md.unit.[jt]sx?` the `.md.unit.` middle part to determine - * it's a markdown file that is also a unit test file. - */ - protected override computePath(sections: string[], parsedPath: ParsedPath): string { - const path = super.computePath(sections, parsedPath); - return path.replaceAll(/md-(unit|i9n|e2e|integration|test|tests|spec)$/g, ''); + protected computeFileName(rawFileName: string): string { + const rawFile = rawFileName.replaceAll(/\.md$/g, ''); + return super.computeFileName(rawFile); } protected override async readVFile(rootPath: string, filename: string): Promise {