Skip to content

Commit

Permalink
style: move tests to ./tests
Browse files Browse the repository at this point in the history
  • Loading branch information
konhi committed Oct 5, 2021
1 parent d3f9d77 commit 414c11d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export default {
// rootDir: undefined,

// A list of paths to directories that Jest should use to search for files in
roots: [
"<rootDir>/src"
],
// roots: [
// "<rootDir>/src"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
Expand Down Expand Up @@ -147,8 +147,7 @@ export default {

// The glob patterns Jest uses to detect test files
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
"**/tests/**/*.ts"
],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/tests/scraper.test.ts → tests/scraper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import scrapeNews from '../scraper'
import scrapeNews from '../src/scraper'
import fs from 'fs'

const mockURL = 'https://konhi.me/zseis/zseis.html'

const expectedData = {
mock: fs.readFileSync('src/tests/expected/news.json', 'utf-8')
mock: fs.readFileSync('./tests/expected/news.json', 'utf-8')
}

test('Data from mock as expected', async () => {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
"outDir": "dist/", /* Specify an output folder for all emitted files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down Expand Up @@ -97,5 +97,5 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["src/**/*.ts", "test/**/*.ts"]
"include": ["src/**/*.ts", "tests/**/*.ts"]
}

0 comments on commit 414c11d

Please sign in to comment.