1.4.2 • Published 8 years ago

passmarked v1.4.2

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
8 years ago

Passmarked

NPM Build Status

CLI/Module/Framework for the Passmarked API that can be used for easy integrations and general horse play. Intended to be usable as a simple tool for your development workflow but also usable on services like Jenkins with a API to integrate into your own code. Providing a framework the package also allows any system to run any of the open source Passmarked rules directly from your system.

Install

NPM

npm install -g passmarked

View the project at npmjs.com/package/passmarked.

From Source

To build from source:

git clone git@github.com:passmarked/passmarked.git passmarked/
cd passmarked/
npm install

Terminal Usage

# get general help and usage information
passmarked --help

# test a host
passmarked http://example.com

# test many hosts with json output (default delimiter is \n)
passmarked --format=json --output=outfile.json < mysites.txt

# comma-delimited string of addresses
passmarked google.com,example.com

# perform a recursive crawl on given hosts
passmarked -r google.com,example.com

Module

The module can also be used as a regular module that allows programs to integrate with the Passmarked system.

API

Quick start

Install

npm install --save passmarked

Test a single page

Run a single page and return all issues and information gathered from the page. See the wiki for details on the API and events for information on realtime events.

passmarked.create({
  url:     'http://example.com',
  token:   '<token>'
}).on('done', function(result) {
  // or use:
  // var result = this.getResult();
  console.log('done with a score of', result.getScore())
  console.dir(result.toJSON())
}).on('update', function(result) {
  // or use:
  // var result = this.getResult()
  console.log(result.countPendingTests() + '/' + result.countTests())
}).start(function(err) {
  if (err) {
    console.log('Something went wrong starting the report')
    console.error(err)
  } else {
    console.log('Report started')
  }
})

Run a recursive report over a entire domain

Example running a site wide report, requested websites must be registered on passmarked.com. See the wiki for details on the API and events for information on realtime events.

passmarked.create({
  url:         'http://example.com',
  token:       '<token>',
  recursive:   true,
  limit:       50,
  bail:        true,
  patterns:    []
}).on('done', function(result) {
  // or use:
  // var result = this.getResult()
  console.log(
    'done with a score of',
    result.getScore(),
    'after going through',
    result.countPages(),
    'pages'
  )
  console.dir(result.toJSON())
}).on('error', function(err) {
  console.log('Problem starting report', err)
}).on('page', function(page) {
  console.log(
    'Processed page',
    page.getURL(),
    'score',
    page.getScore()
  )
}).on('update', function(result) {
  // or use:
  // var result = this.getResult()
  console.log('pages', (
    result.countProcessedPages() + '/' + result.countPages())
  )
}).start(function(err, crawl) {
  if (err) {
    console.log('problem starting the recursive report', err)
  } else {
    console.log('crawl started')
  }
})

Download historical report for a page

The following shows how to download a single historical report from our archive.

passmarked.getReport('2016049a03452018', function(err, report) {
  console.error(err)
  console.dir(report.getURL())
  console.dir(report.toJSON())
})

Registered websites

Returns the list of websites that the given token has access to.

passmarked.getWebsites('<token>', function(err, websites) {
  console.error(err)
  for (var i = 0; i < websites.length; i++) {
    console.log('->', websites[i].getDomain())
  }
})

Run selected tests locally

Passmarked is built to be a framework that can be used by anyone, all our rules that passmarked.com checks are open and available for use.

List of provided tests that anyone can run:

Written your own? Open a PR on the Passmarked repo with your new worker added to the list.

The Passmarked module also provides a way to easily download and run the tests in your own apps, and even write your own:

Using promises:

passmarked.createRunner(
  require('@passmarked/network'),
  require('@passmarked/inspect')
).run({
  url: 'http://example.com'
}).then(function(rules) {
  for (var i = 0; i < rules.length; i++) {
    console.log('*', rules[i].getMessage())
  }
}).catch(function(err) {
  console.error(err)
})

Using callbacks:

passmarked.createRunner(
  require('@passmarked/network'),
  require('@passmarked/inspect')
).run({
  url: 'http://example.com'
}, function(err, rules) {
  for(var i = 0; i < rules.length; i++) {
    console.log('*', rules[i].getMessage())
  }
});

Contributing

  1. Fork the project
  2. Write a test that reproduces the bug
  3. Fix the bug without breaking any of the existing tests
  4. Submit a pull request

We're busy building the tests and refactoring code as we go. If you spot any area that could use help feel free to open a PR.

License

Copyright 2016 Passmarked Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.19

8 years ago

0.5.18

9 years ago

0.5.17

9 years ago

0.5.16

9 years ago

0.5.15

9 years ago

0.5.14

9 years ago

0.5.13

9 years ago

0.5.12

9 years ago

0.5.11

9 years ago

0.5.10

9 years ago

0.5.9

9 years ago

0.5.8

9 years ago

0.5.7

9 years ago

0.5.5

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.22

9 years ago

0.4.21

9 years ago

0.4.20

9 years ago

0.4.19

9 years ago

0.4.18

9 years ago

0.4.17

9 years ago

0.4.16

9 years ago

0.4.15

9 years ago

0.4.14

9 years ago

0.4.13

10 years ago

0.4.12

10 years ago

0.4.11

10 years ago

0.4.10

10 years ago

0.4.9

10 years ago

0.4.7

10 years ago

0.4.6

10 years ago

0.4.5

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.183

10 years ago

0.1.182

10 years ago

0.1.181

10 years ago

0.1.179

10 years ago

0.1.178

10 years ago

0.1.177

10 years ago

0.1.176

10 years ago

0.1.175

10 years ago

0.1.174

10 years ago

0.1.173

10 years ago

0.1.172

10 years ago

0.1.171

10 years ago

0.1.170

10 years ago

0.1.169

10 years ago

0.1.168

10 years ago

0.1.167

10 years ago

0.1.166

10 years ago

0.1.165

10 years ago

0.1.164

10 years ago

0.1.163

10 years ago

0.1.162

10 years ago

0.1.161

10 years ago

0.1.160

10 years ago

0.1.159

10 years ago

0.1.158

10 years ago

0.1.157

10 years ago

0.1.156

10 years ago

0.1.155

10 years ago

0.1.154

10 years ago

0.1.153

10 years ago

0.1.152

10 years ago

0.1.151

10 years ago

0.1.150

10 years ago

0.1.149

10 years ago

0.1.148

10 years ago

0.1.147

10 years ago

0.1.146

10 years ago

0.1.145

10 years ago

0.1.144

10 years ago

0.1.143

10 years ago

0.1.142

10 years ago

0.1.141

10 years ago

0.1.140

10 years ago

0.1.139

10 years ago

0.1.138

10 years ago

0.1.137

10 years ago

0.1.136

10 years ago

0.1.135

10 years ago

0.1.134

10 years ago

0.1.133

10 years ago

0.1.132

10 years ago

0.1.131

10 years ago

0.1.130

10 years ago

0.1.129

10 years ago

0.1.128

10 years ago

0.1.127

10 years ago

0.1.126

10 years ago

0.1.125

10 years ago

0.1.124

10 years ago

0.1.123

10 years ago

0.1.122

10 years ago

0.1.121

10 years ago

0.1.120

10 years ago

0.1.119

10 years ago

0.1.118

10 years ago

0.1.117

10 years ago

0.1.116

10 years ago

0.1.115

10 years ago

0.1.114

10 years ago

0.1.113

10 years ago

0.1.112

10 years ago

0.1.111

10 years ago

0.1.110

10 years ago

0.1.109

10 years ago

0.1.108

10 years ago

0.1.107

10 years ago

0.1.106

10 years ago

0.1.105

10 years ago

0.1.104

10 years ago

0.1.103

10 years ago

0.1.102

10 years ago

0.1.101

10 years ago

0.1.100

10 years ago

0.1.99

10 years ago

0.1.98

10 years ago

0.1.97

10 years ago

0.1.96

10 years ago

0.1.95

10 years ago

0.1.94

10 years ago

0.1.93

10 years ago

0.1.92

10 years ago

0.1.91

10 years ago

0.1.90

10 years ago

0.1.89

10 years ago

0.1.88

10 years ago

0.1.87

10 years ago

0.1.86

10 years ago

0.1.85

10 years ago

0.1.84

10 years ago

0.1.83

10 years ago

0.1.82

10 years ago

0.1.81

10 years ago

0.1.80

10 years ago

0.1.79

10 years ago

0.1.78

10 years ago

0.1.77

10 years ago

0.1.76

10 years ago

0.1.75

10 years ago

0.1.74

10 years ago

0.1.73

10 years ago

0.1.72

10 years ago

0.1.71

10 years ago

0.1.70

10 years ago

0.1.69

10 years ago

0.1.68

10 years ago

0.1.67

10 years ago

0.1.66

10 years ago

0.1.65

10 years ago

0.1.64

10 years ago

0.1.63

10 years ago

0.1.62

10 years ago

0.1.61

10 years ago

0.1.60

10 years ago

0.1.59

10 years ago

0.1.58

10 years ago

0.1.57

10 years ago

0.1.56

10 years ago

0.1.55

10 years ago

0.1.54

10 years ago

0.1.53

10 years ago

0.1.52

10 years ago

0.1.51

10 years ago

0.1.50

10 years ago

0.1.49

10 years ago

0.1.48

10 years ago

0.1.47

10 years ago

0.1.46

10 years ago

0.1.45

10 years ago

0.1.44

10 years ago

0.1.43

10 years ago

0.1.42

10 years ago

0.1.41

10 years ago

0.1.40

10 years ago

0.1.39

10 years ago

0.1.38

10 years ago

0.1.37

10 years ago

0.1.36

10 years ago

0.1.35

10 years ago

0.1.34

10 years ago

0.1.33

10 years ago

0.1.32

10 years ago

0.1.31

10 years ago

0.1.30

10 years ago

0.1.29

10 years ago

0.1.28

10 years ago

0.1.27

10 years ago

0.1.26

10 years ago

0.1.25

10 years ago

0.1.24

10 years ago

0.1.23

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.17

10 years ago

0.1.12

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago