New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@ficusjs/testing

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ficusjs/testing - npm Package Compare versions

Comparing version
2.0.0
to
2.1.0
+3
.ncurc.json
{
"reject": ["standard"]
}
import { html, renderer } from '@ficusjs/renderers/htm-preact'
import { createCustomElement } from '@ficusjs/core/custom-element'
createCustomElement('basic-comp', {
renderer,
render () {
return html`<p>Basic component</p>`
}
})
import test from 'ava'
import { init, render } from '../src/index.mjs'
test.before(init)
test('render basic component', async t => {
const comp = await render('basic-comp', () => import('./component.mjs'))
t.is(comp.querySelector('p').textContent, 'Basic component')
})
+5
-0

@@ -7,2 +7,7 @@ # Changelog

## [2.1.0] - 2022-10-21
### Added
- Add ability to pass options to JSDOM in the `init` function
## [2.0.0] - 2022-10-03

@@ -9,0 +14,0 @@

+6
-2
{
"name": "@ficusjs/testing",
"version": "2.0.0",
"version": "2.1.0",
"description": "Helper functions for component testing",

@@ -11,3 +11,4 @@ "type": "module",

"scripts": {
"lint": "standard \"src/**/*.js\""
"lint": "standard \"src/**/*.mjs\"",
"test": "ava \"test/**/*.spec.mjs\""
},

@@ -34,2 +35,5 @@ "repository": {

"devDependencies": {
"@ficusjs/core": "2.0.0",
"@ficusjs/renderers": "5.3.0",
"ava": "4.3.3",
"standard": "16.0.4"

@@ -36,0 +40,0 @@ },

@@ -33,4 +33,13 @@ # FicusJS testing

test.before(init)
// if passing options to JSDOM
test.before(() => init({ runScripts: 'dangerously' }))
```
The `init` function accepts the following optional arguments:
| Name | Type | Description |
|------------|----------|---------------------------------------|
| `options` | `object` | An object of options to pass to JSDOM |
### render function

@@ -56,5 +65,5 @@

| Name | Type | Description |
| --- | --- | --- |
| `tagName` | `string` | The web component tag name |
| Name | Type | Description |
|------------|------------|------------------------------------------------------------------------|
| `tagName` | `string` | The web component tag name |
| `importer` | `function` | A function that registers a web component. This can return a `Promise` |

@@ -61,0 +70,0 @@

import { JSDOM } from 'jsdom'
export function init () {
const dom = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>')
export function init (options = {}) {
const dom = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>', options)
globalThis.dom = dom

@@ -6,0 +6,0 @@ globalThis.Node = dom.Node