• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 18128625706

30 Sep 2025 11:38AM UTC coverage: 73.078% (-2.4%) from 75.488%
18128625706

push

github

scriptype
Facets wip5

Handle permalinking from entries to collection facets through its faceted fields. Every facet field becomes an object: { value, facetPermalink }. If the field is a link to another entry (already object), then the facetPermalink property is added on top of existing entry object.

490 of 795 branches covered (61.64%)

Branch coverage included in aggregate %.

8 of 25 new or added lines in 4 files covered. (32.0%)

118 existing lines in 9 files now uncovered.

2276 of 2990 relevant lines covered (76.12%)

313.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.89
/src/compiler/contentModel2/models/asset.js
1
const { join, resolve } = require('path')
9✔
2
const { makePermalink } = require('../helpers')
9✔
3

4
const defaultSettings = {
9✔
5
  assetsDirectory: 'assets'
6
}
7
module.exports = function Asset(settings = defaultSettings) {
9!
8
  const assetsDirectoryNameOptions = [settings.assetsDirectory, 'assets']
9✔
9

10
  const isAssetsDirectory = (node) => {
9✔
11
    return (
×
12
      node.children &&
×
13
      node.name.match(
14
        new RegExp(`^(${assetsDirectoryNameOptions.join('|')})$`)
15
      )
16
    )
17
  }
18

19
  return {
9✔
20
    match: node => true,
×
21
    matchAssetsDirectory: isAssetsDirectory,
22

23
    create: (node, context) => {
24
      const permalink = makePermalink(
×
25
        context.peek().permalink,
26
        settings.assetsDirectory,
27
        node.name
28
      )
29

30
      const outputPath = join(
×
31
        context.peek().outputPath,
32
        settings.assetsDirectory,
33
        node.name
34
      )
35

36
      return {
×
37
        ...node,
38
        context,
39
        permalink,
40
        outputPath,
41
        date: new Date(node.stats.birthtime || Date.now())
×
42
      }
43
    },
44

45
    afterEffects: (contentModel, asset) => {},
46

47
    render: (renderer, asset) => {
UNCOV
48
      return renderer.copy({
×
49
        src: asset.absolutePath,
50
        dest: asset.outputPath,
51
        recursive: !!asset.children
52
      })
53
    }
54
  }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc