Skip to content

Commit f71b9f2

Browse files
committed
Add some tests
1 parent 65c5105 commit f71b9f2

File tree

10 files changed

+1962
-154
lines changed

10 files changed

+1962
-154
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
node_modules
66
dist
77
.npmrc
8+
coverage/**/*
9+
!coverage/badge-lines.svg
810

911
.DS_Store

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# rollup-plugin-inline-code
1+
# rollup-plugin-inline-code
2+
3+
[![NPM version](https://img.shields.io/npm/v/rollup-plugin-inline-code.svg?style=flat)](https://www.npmjs.com/package/rollup-plugin-inline-code) [![NPM downloads](https://img.shields.io/npm/dm/rollup-plugin-inline-code.svg?style=flat)](https://www.npmjs.com/package/rollup-plugin-inline-code) [![Svelte v3](https://img.shields.io/badge/rollup-blueviolet.svg)](https://rollupjs.org/) ![Coverage](./coverage/badge-lines.svg)
4+
5+
Rollup plugin for inline scripts into code
6+
7+
## :rocket: Features
8+
9+
This Rollup plugin is like [raw-loader](https://v4.webpack.js.org/loaders/raw-loader/) plugin for Webpack
10+
11+
- Easy to use (simple configuration)
12+
- Fully customizable: you can adjust it for yourself :t-rex:
13+
- Typescript code highlighting works :fire:
14+
15+
## Install
16+
17+
```bash
18+
npm i rollup-plugin-inline-code
19+
```
20+
21+
## License
22+
23+
MIT © [Denis Stasyev](https://github.com/denisstasyev)

babel.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Babel is used to transpile Jest test files from TypeScript into JavaScript
2+
3+
module.exports = {
4+
presets: [
5+
['@babel/preset-env', { targets: { node: 'current' } }],
6+
'@babel/preset-typescript'
7+
],
8+
plugins: [
9+
// Babel doesn't use .tsconfig.json file, "babel-plugin-module-resolver" implements "baseUrl" option
10+
["module-resolver", {
11+
"root": ["."],
12+
"alias": {
13+
"src": "./src",
14+
}
15+
}]
16+
]
17+
}

coverage/badge-lines.svg

Lines changed: 1 addition & 0 deletions
Loading

jest.config.ts

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property and type check, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
export default {
7+
// All imported modules in your tests should be mocked automatically
8+
// automock: false,
9+
10+
// Stop running tests after `n` failures
11+
// bail: 0,
12+
13+
// The directory where Jest should store its cached dependency information
14+
// cacheDirectory: "/private/var/folders/22/2561sly522v9mgqg3nz2tly00000gp/T/jest_dy",
15+
16+
// Automatically clear mock calls and instances between every test
17+
clearMocks: true,
18+
19+
// Indicates whether the coverage information should be collected while executing the test
20+
collectCoverage: true,
21+
22+
// An array of glob patterns indicating a set of files for which coverage information should be collected
23+
// collectCoverageFrom: undefined,
24+
25+
// The directory where Jest should output its coverage files
26+
coverageDirectory: 'coverage',
27+
28+
// An array of regexp pattern strings used to skip coverage collection
29+
// coveragePathIgnorePatterns: [
30+
// "/node_modules/"
31+
// ],
32+
33+
// Indicates which provider should be used to instrument code for coverage
34+
coverageProvider: 'v8',
35+
36+
// A list of reporter names that Jest uses when writing coverage reports
37+
coverageReporters: [
38+
// "json",
39+
'json-summary',
40+
// "text",
41+
// "lcov",
42+
// "clover"
43+
],
44+
45+
// An object that configures minimum threshold enforcement for coverage results
46+
// coverageThreshold: undefined,
47+
48+
// A path to a custom dependency extractor
49+
// dependencyExtractor: undefined,
50+
51+
// Make calling deprecated APIs throw helpful error messages
52+
// errorOnDeprecated: false,
53+
54+
// Force coverage collection from ignored files using an array of glob patterns
55+
// forceCoverageMatch: [],
56+
57+
// A path to a module which exports an async function that is triggered once before all test suites
58+
// globalSetup: undefined,
59+
60+
// A path to a module which exports an async function that is triggered once after all test suites
61+
// globalTeardown: undefined,
62+
63+
// A set of global variables that need to be available in all test environments
64+
// globals: {},
65+
66+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
67+
// maxWorkers: "50%",
68+
69+
// An array of directory names to be searched recursively up from the requiring module's location
70+
// moduleDirectories: [
71+
// "node_modules"
72+
// ],
73+
74+
// An array of file extensions your modules use
75+
// moduleFileExtensions: [
76+
// "js",
77+
// "jsx",
78+
// "ts",
79+
// "tsx",
80+
// "json",
81+
// "node"
82+
// ],
83+
84+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
85+
// moduleNameMapper: {},
86+
87+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
88+
// modulePathIgnorePatterns: [],
89+
90+
// Activates notifications for test results
91+
// notify: false,
92+
93+
// An enum that specifies notification mode. Requires { notify: true }
94+
// notifyMode: "failure-change",
95+
96+
// A preset that is used as a base for Jest's configuration
97+
// preset: undefined,
98+
99+
// Run tests from one or more projects
100+
// projects: undefined,
101+
102+
// Use this configuration option to add custom reporters to Jest
103+
// reporters: undefined,
104+
105+
// Automatically reset mock state between every test
106+
// resetMocks: false,
107+
108+
// Reset the module registry before running each individual test
109+
// resetModules: false,
110+
111+
// A path to a custom resolver
112+
// resolver: undefined,
113+
114+
// Automatically restore mock state between every test
115+
// restoreMocks: false,
116+
117+
// The root directory that Jest should scan for tests and modules within
118+
// rootDir: undefined,
119+
120+
// A list of paths to directories that Jest should use to search for files in
121+
// roots: [
122+
// "<rootDir>"
123+
// ],
124+
125+
// Allows you to use a custom runner instead of Jest's default test runner
126+
// runner: "jest-runner",
127+
128+
// The paths to modules that run some code to configure or set up the testing environment before each test
129+
// setupFiles: [],
130+
131+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
132+
// setupFilesAfterEnv: [],
133+
134+
// The number of seconds after which a test is considered as slow and reported as such in the results.
135+
// slowTestThreshold: 5,
136+
137+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
138+
// snapshotSerializers: [],
139+
140+
// The test environment that will be used for testing
141+
// testEnvironment: "jest-environment-node",
142+
143+
// Options that will be passed to the testEnvironment
144+
// testEnvironmentOptions: {},
145+
146+
// Adds a location field to test results
147+
// testLocationInResults: false,
148+
149+
// The glob patterns Jest uses to detect test files
150+
// testMatch: [
151+
// "**/__tests__/**/*.[jt]s?(x)",
152+
// "**/?(*.)+(spec|test).[tj]s?(x)"
153+
// ],
154+
155+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
156+
// testPathIgnorePatterns: [
157+
// "/node_modules/"
158+
// ],
159+
160+
// The regexp pattern or array of patterns that Jest uses to detect test files
161+
// testRegex: [],
162+
163+
// This option allows the use of a custom results processor
164+
// testResultsProcessor: undefined,
165+
166+
// This option allows use of a custom test runner
167+
// testRunner: "jest-circus/runner",
168+
169+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
170+
// testURL: "http://localhost",
171+
172+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
173+
// timers: "real",
174+
175+
// A map from regular expressions to paths to transformers
176+
// transform: undefined,
177+
178+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
179+
// transformIgnorePatterns: [
180+
// "/node_modules/",
181+
// "\\.pnp\\.[^\\/]+$"
182+
// ],
183+
184+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
185+
// unmockedModulePathPatterns: undefined,
186+
187+
// Indicates whether each individual test should be reported during the run
188+
// verbose: undefined,
189+
190+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
191+
// watchPathIgnorePatterns: [],
192+
193+
// Whether to use watchman for file crawling
194+
// watchman: true,
195+
}

0 commit comments

Comments
 (0)