Skip to content

Commit

Permalink
tests: speed up smoketest
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Dec 29, 2023
1 parent 6d53151 commit 35529e0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/compile_all_smoketest.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { globSync } from 'glob';
import { readFileSync } from 'fs';
import { Project } from 'ts-morph';
import path from 'path';
import ts from 'typescript';
import { Project } from 'ts-morph';
import { Compiler } from '../src/lib';

const TESTS_PROJECT = new Project({
tsConfigFilePath: path.join(__dirname, '..', 'tests', 'contracts', 'tsconfig.json'),
});

const EXAMPLES_PROJECT = new Project({
tsConfigFilePath: path.join(__dirname, '..', 'examples', 'tsconfig.json'),
});

async function main() {
const files = globSync(path.join(__dirname, '../**/*.algo.ts'));
files.forEach((file) => {
if (file.includes('compile_errors')) return;
const tsConfigFilePath = ts.findConfigFile(file, ts.sys.fileExists, 'tsconfig.json');

const project = new Project({
tsConfigFilePath,
});
const project = file.includes('examples/') ? EXAMPLES_PROJECT : TESTS_PROJECT;
Compiler.compileAll(readFileSync(file, 'utf-8'), project, { filename: file });
});
}
Expand Down

0 comments on commit 35529e0

Please sign in to comment.