| 1082 | } |
| 1083 | |
| 1084 | public async experimental_parseSpecification(specification: TestSpecification): Promise<TestModule> { |
| 1085 | if (this.mode !== 'test') { |
| 1086 | throw new Error(`The \`experimental_parseSpecification\` does not support "${this.mode}" mode.`) |
| 1087 | } |
| 1088 | const file = await astCollectTests(specification.project, specification.moduleId).catch((error) => { |
| 1089 | return createFailedFileTask(specification.project, specification.moduleId, error) |
| 1090 | }) |
| 1091 | const config = specification.project.config |
| 1092 | const hasOnly = someTasksAreOnly(file) |
| 1093 | const tagsFilter = this.config.tagsFilter |
| 1094 | ? createTagsFilter(this.config.tagsFilter, this.config.tags) |
| 1095 | : undefined |
| 1096 | interpretTaskModes( |
| 1097 | file, |
| 1098 | config.testNamePattern, |
| 1099 | specification.testLines, |
| 1100 | specification.testIds, |
| 1101 | tagsFilter, |
| 1102 | hasOnly, |
| 1103 | false, |
| 1104 | config.allowOnly, |
| 1105 | ) |
| 1106 | // register in state, so it can be retrieved by "getReportedEntity" |
| 1107 | this.state.collectFiles(specification.project, [file]) |
| 1108 | return this.state.getReportedEntity(file) as TestModule |
| 1109 | } |
| 1110 | |
| 1111 | /** |
| 1112 | * Collect tests in specified modules. Vitest will run the files to collect tests. |