Socket
Socket
Sign inDemoInstall

amphtml-validator

Package Overview
Dependencies
3
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.32 to 1.0.33

86

index_test.js

@@ -49,3 +49,3 @@ #!/usr/bin/env node

it('validator_minified.js was built (run build.py if this fails)', function() {
expect(fs.statSync('../dist/validator_minified.js').isFile()).toBe(true);
expect(fs.statSync('../../dist/validator_minified.js').isFile()).toBe(true);
});

@@ -55,3 +55,3 @@

// Note: This will use the validator that was built with build.py.
ampValidator.getInstance(/*validatorJs*/ '../dist/validator_minified.js')
ampValidator.getInstance(/*validatorJs*/ '../../dist/validator_minified.js')
.then(function(instance) {

@@ -71,5 +71,7 @@ const validationResult = instance.validateString('');

// Note: This will use the validator that was built with build.py.
const mini = fs.readFileSync(
'../testdata/feature_tests/minimum_valid_amp.html', 'utf-8').trim();
ampValidator.getInstance(/*validatorJs*/ '../dist/validator_minified.js')
const mini =
fs.readFileSync(
'../../testdata/feature_tests/minimum_valid_amp.html', 'utf-8')
.trim();
ampValidator.getInstance(/*validatorJs*/ '../../dist/validator_minified.js')
.then(function(instance) {

@@ -89,6 +91,8 @@ const validationResult = instance.validateString(mini);

// Note: This will use the validator that was built with build.py.
const mini = fs.readFileSync(
'../testdata/amp4ads_feature_tests/min_valid_amp4ads.html', 'utf-8')
.trim();
ampValidator.getInstance(/*validatorJs*/ '../dist/validator_minified.js')
const mini =
fs.readFileSync(
'../../testdata/amp4ads_feature_tests/min_valid_amp4ads.html',
'utf-8')
.trim();
ampValidator.getInstance(/*validatorJs*/ '../../dist/validator_minified.js')
.then(function(instance) {

@@ -119,11 +123,13 @@ const validationResult = instance.validateString(mini, 'AMP4ADS');

const severalErrorsHtml =
fs.readFileSync('../testdata/feature_tests/several_errors.html', 'utf-8')
.trim();
fs.readFileSync(
'../../testdata/feature_tests/several_errors.html', 'utf-8')
.trim();
const severalErrorsOut =
fs.readFileSync('../testdata/feature_tests/several_errors.out', 'utf-8')
.split('\n')
.filter(isErrorLine)
.join('\n');
fs.readFileSync(
'../../testdata/feature_tests/several_errors.out', 'utf-8')
.split('\n')
.filter(isErrorLine)
.join('\n');
ampValidator.getInstance(/*validatorJs*/ '../dist/validator_minified.js')
ampValidator.getInstance(/*validatorJs*/ '../../dist/validator_minified.js')
.then(function(instance) {

@@ -157,3 +163,3 @@ const validationResult = instance.validateString(severalErrorsHtml);

// Note: This points the library at a file that's not even Javascript.
ampValidator.getInstance(/*validatorJs*/ '../dist/validator.protoascii')
ampValidator.getInstance(/*validatorJs*/ '../../dist/validator.protoascii')
.then(function(instance) {

@@ -172,6 +178,8 @@ fail('We should not get here since this is not a good validator.');

it('also works with newInstance', function() {
const mini = fs.readFileSync(
'../testdata/feature_tests/minimum_valid_amp.html', 'utf-8').trim();
const mini =
fs.readFileSync(
'../../testdata/feature_tests/minimum_valid_amp.html', 'utf-8')
.trim();
const validatorJsContents =
fs.readFileSync('../dist/validator_minified.js', 'utf-8');
fs.readFileSync('../../dist/validator_minified.js', 'utf-8');
const resultForMini =

@@ -183,4 +191,5 @@ ampValidator.newInstance(validatorJsContents).validateString(mini);

const severalErrorsHtml =
fs.readFileSync('../testdata/feature_tests/several_errors.html', 'utf-8')
.trim();
fs.readFileSync(
'../../testdata/feature_tests/several_errors.html', 'utf-8')
.trim();
const resultForSeveralErrors = ampValidator.newInstance(validatorJsContents)

@@ -194,11 +203,13 @@ .validateString(severalErrorsHtml);

const severalErrorsOut =
fs.readFileSync('../testdata/feature_tests/several_errors.out', 'utf-8')
.split('\n')
.filter(isErrorLine)
.splice(1) // trim 1st line
.join('\n');
fs.readFileSync(
'../../testdata/feature_tests/several_errors.out', 'utf-8')
.split('\n')
.filter(isErrorLine)
.splice(1) // trim 1st line
.join('\n');
execFile(
process.execPath,
[
'../nodejs/cli.js', '--format=text',
'../js/nodejs/cli.js',
'--format=text',
'--validator_js=../dist/validator_minified.js',

@@ -208,3 +219,3 @@ 'feature_tests/several_errors.html',

],
{'cwd': '../testdata'}, // Run inside the testdata dir to match paths.
{'cwd': '../../testdata'}, // Run inside the testdata dir to match paths.
function(error, stdout, stderr) {

@@ -222,3 +233,4 @@ expect(error).toBeDefined(); // At least one file had errors.

[
'../nodejs/cli.js', '--format=json',
'../js/nodejs/cli.js',
'--format=json',
'--validator_js=../dist/validator_minified.js',

@@ -228,3 +240,3 @@ 'feature_tests/several_errors.html',

],
{'cwd': '../testdata'}, // Run inside the testdata dir to match paths.
{'cwd': '../../testdata'}, // Run inside the testdata dir to match paths.
function(error, stdout, stderr) {

@@ -255,7 +267,7 @@ expect(error).toBeDefined(); // At least one file had errors

fs.readFileSync(
'../testdata/amp4ads_feature_tests/style-amp-custom.out',
'utf-8')
'../../testdata/amp4ads_feature_tests/style-amp-custom.out',
'utf-8')
.split('\n')
.filter(isErrorLine)
.splice(1) // trim 1st line
.splice(1) // trim 1st line
.join('\n');

@@ -265,3 +277,5 @@ execFile(

[
'../nodejs/cli.js', '--format=text', '--html_format=AMP4ADS',
'../js/nodejs/cli.js',
'--format=text',
'--html_format=AMP4ADS',
'--validator_js=../dist/validator_minified.js',

@@ -271,3 +285,3 @@ 'amp4ads_feature_tests/style-amp-custom.html',

],
{'cwd': '../testdata'}, // Run inside the testdata dir to match paths.
{'cwd': '../../testdata'}, // Run inside the testdata dir to match paths.
function(error, stdout, stderr) {

@@ -274,0 +288,0 @@ expect(error).toBeDefined(); // At least one file had errors.

@@ -397,3 +397,3 @@ /**

.option(
'--html_format <AMP|AMP4ADS|AMP4EMAIL|ACTIONS>',
'--html_format <AMP|AMP4ADS|AMP4EMAIL>',
'The input format to be validated.\n' +

@@ -418,7 +418,5 @@ ' AMP by default.',

if (program.html_format !== 'AMP' && program.html_format !== 'AMP4ADS' &&
program.html_format !== 'AMP4EMAIL' &&
program.html_format !== 'ACTIONS') {
program.html_format !== 'AMP4EMAIL') {
process.stderr.write(
'--html_format must be set to "AMP", "AMP4ADS", "AMP4EMAIL", or ' +
'"ACTIONS.\n',
'--html_format must be set to "AMP", "AMP4ADS", or "AMP4EMAIL".\n',
function() {

@@ -425,0 +423,0 @@ process.exit(1);

{
"name": "amphtml-validator",
"version": "1.0.32",
"version": "1.0.33",
"description": "Official validator for AMP HTML (www.ampproject.org)",

@@ -16,3 +16,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/ampproject/amphtml/tree/master/validator/nodejs/"
"url": "https://github.com/ampproject/amphtml/tree/master/validator/js/nodejs/"
},

@@ -19,0 +19,0 @@ "bin": {

@@ -7,3 +7,3 @@ # amphtml-validator Node.js Package

The source code is available at
https://github.com/ampproject/amphtml/tree/master/validator/nodejs.
https://github.com/ampproject/amphtml/tree/master/validator/js/nodejs.

@@ -57,2 +57,6 @@ ## Command Line Tool

### 1.0.33
- Update repository location.
### 1.0.32

@@ -59,0 +63,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc