Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
jest-svelte-transformer
Advanced tools
svelte component transformer to compile svelte 3 components on the fly for tests files
npm install -D jest-svelte-transformer
In your package.json
add these lines:
"jest": {
"transform": {
"^.+\\.svelte$": "jest-svelte-transformer"
}
}
To add preprocessors you can create a config file at the root of your project named jest-svelte-transformer.config.js
. Here is an example of what you could have in this file:
const presetenv = require('postcss-preset-env')
const postcss = require('postcss')
module.exports = {
preprocessors: {
async style ({ content: code }) {
const { css } = await postcss([presetenv({
"stage": 0,
"features": {
"calc": false
}
})]).process(code, { from: undefined })
return { code: css }
}
},
compileOptions: {
dev: true,
immutable: true
}
}
Preprocessors and compile options config follows the svelte api (https://svelte.dev/docs#svelte_preprocess, https://svelte.dev/docs#svelte_compile)
If you don't need preprocessors but only compile options, you can put the config into an rc
file — .jest-svelte-transformerrc
— Like so:
{
"compileOptions": {
"dev": true,
"immutable": true
}
}
Babel is used to transpile svelte compiled code so that it could be loaded as a
commonjs
module, so any babel config set up in your project will also be used to transpile svelte compiled code.
By setting LOG_LEVEL
environment variable to trace
you can see config loading errors, like so for example:
LOG_LEVEL=trace npm test -- widget.test.js
FAQs
svelte component transformer to compile svelte 3 components on the fly for tests files
We found that jest-svelte-transformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.